The equivalent of "use lib 'blah'" on the commandline is "-I blah", just
like "-M bloop" is the equivalent of "use 'bloop'" in code.

HTH
  - Timo

On 14/09/2018 12:52, Todd Chester wrote:
> Hi All,
>
> With a one liner, how to I load a module that resides in the
> current directory?
>
> $ ls PrintColors.pm6
> PrintColors.pm6
>
>
> $ perl6 -MPrintColors -e 'PrintRed "Hi";'
> ===SORRY!===
> Could not find PrintColors at line 1 in:
>     /home/tony/.perl6
>     /opt/rakudo-pkg/share/perl6/site
>     /opt/rakudo-pkg/share/perl6/vendor
>     /opt/rakudo-pkg/share/perl6
>     CompUnit::Repository::AbsolutePath<58670368>
>     CompUnit::Repository::NQP<53138976>
>     CompUnit::Repository::Perl5<53139016>
>
>
> $ perl6 -M./PrintColors -e 'PrintRed "Hi";'
> ===SORRY!===
> Could not find ./PrintColors at line 1 in:
>     /home/tony/.perl6
>     /opt/rakudo-pkg/share/perl6/site
>     /opt/rakudo-pkg/share/perl6/vendor
>     /opt/rakudo-pkg/share/perl6
>     CompUnit::Repository::AbsolutePath<53332448>
>     CompUnit::Repository::NQP<47798144>
>     CompUnit::Repository::Perl5<47798184>
>
>
> This works:
> $ p6 'use lib "/home/linuxutil"; use PrintColors; PrintRed "Hi\n";'
> Hi
>
> But how do I get it into the "-M"?
>
> Many thanks,
> -T

Reply via email to