I want to use Perl6 modules to group some functions that I often use. Since these functions are all related to each other, I do not like to add them to the class.
I like the idea usewhere you can choose which functions to import, but I don’t like that the imported functions are then stored in the global namespace.
For example, if I have a file my_util.pm6:
unit module my_util;
our sub greet($who) is export(:greet) {
say $who;
}
sub greet2($who) is export(:greet2) {
say $who;
}
sub greet3($who) is export(:greet3) {
say $who;
}
and file test.p6:
use v6.c;
use lib '.';
use my_util :greet2;
greet("Bob");
greet2("Bob");
greet3("Bob");
my_util::greet("Alice");
my_util::greet2("Alice");
my_util::greet3("Alice");
I would like to call all functions through my_util::greet(), not just through greet().
greet(), my_util.pm6, , , . , , , (.. )
- , ?