Hi Bruce,

This has to do with the way I am importing subs from modules.

When importing subs, I like to declare which subs I
am importing.  Otherwise my code is a nightmare to maintain.
"Where the heck did that subs comes from? Is its a system
subs or ...."


For instance, in  Perl 5:

    use Term::ANSIColor qw ( BOLD BLUE RED GREEN RESET );

imports "BOLD BLUE RED GREEN RESET".


Perl 6 has improved on this with selective importing and exporting.
The ":" is part of the tag:

https://docs.perl6.org/language/modules#Exporting_and_selective_importing

For instance:

PrintColors.pm6 exports with:

sub PrintBlue ( **@args ) is export( :PrintBlue ) { print color('bold'), color('blue'), |@args, color('reset'); }

The tag is `is export( :PrintBlue )`


And imports with:

use PrintColors :PrintRed, :PrintGreen, :PrintBlue, :PrintErr, :PrintRedErr, :PrintGreenErr, :PrintBlueErr;

What I am after is a way to run a one liner with
this type of export using the "-M" switch".

perl6 -I /home/linuxutil/p6lib -M "PrintColors :PrintBlue" -e 'PrintBlue( "Blue\n" );'

       Could not find PrintColors :PrintBlue at line 1 in:

-T

Reply via email to