On 08/14/2018 03:01 AM, ToddAndMargo wrote:
Hi All,


I presume this is failing as the current directory is not
in the "lib" path:


$ perl6 -MPrintColors 'PrintBlue( "Blue\n" );'
Could not open PrintBlue( "Blue" ). Failed to stat file: no such
file or directory


This does work, but what a lot of extra work:

$ perl6 -e 'use lib "/home/linuxutil"; use PrintColors; PrintBlue( "Blue\n" );'
Blue



What are the rules for calling modules from the command line?


Many thanks,
-T

Follow up, with Timo's help.  Note keeper note:



Perl6: running modules from the command line:


-Mxxxx   xxxx = module name without the pm6 and no space

-Ixxxx   xxxx = local path to read and no space;
                "./" is accepted for the current directory

Don't forget the -e


$ perl6 -I./ -MPrintColors -e 'PrintBlue( "Blue\n" );'
Blue

$ perl6 -I/home/linuxutil -MPrintColors -e 'PrintBlue( "Blue\n" );'
Blue

$ perl6 -e 'use lib "/home/linuxutil"; use PrintColors; PrintBlue( "Blue\n" );'
Blue

Reply via email to