develooper Front page | perl.perl6.users | Postings from September 2018

Re: I need -M help

Thread Previous | Thread Next
From:
Timo Paulssen
Date:
September 14, 2018 10:58
Subject:
Re: I need -M help
Message ID:
26a9a98c-2609-27a5-36f9-e69d2695e934@wakelift.de
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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About