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

I need -M help

Thread Next
From:
Todd Chester
Date:
September 14, 2018 10:52
Subject:
I need -M help
Message ID:
a4768e09-ff56-a873-2247-8071d725d9b6@zoho.com
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 Next


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