To expand on why putting the file in a directory doesn't Just Work, and
why so much magic needs to be there for it to work: loading modules is a
complicated thing in Perl 6, and long story short, if you want to be
able to have multiple versions installed and loadable at the same time,
you need some magic under the hood to compensate for that. This magic is
what makes installing/precompiling a module you want to have installed
more complicated than a couple of 'mv's.
If you want to avoid the overhead of panda or other installers (to their
defense, there are several good reasons why they're so bulky and
complicated :)), I sometimes use a script based on Module::Toolkit,
where if you want to "just install the damned thing, nothing else", it's
just a simple 'mtk install .':
https://gist.github.com/tadzik/dc5c12cab0dc141167fb850f9ede2117
Hope this helps,
tadzik
On 01/05/16 15:23, Brock Wilcox wrote:
I recommend putting your module into a 'lib' dir near your script.
Then in your script add:
use lib 'lib';
That way you don't have to add the -l param.
On May 1, 2016 09:21, "Fernando Santagata" <nando.santag...@gmail.com
<mailto:nando.santag...@gmail.com>> wrote:
Hello,
I'm trying to write a module and make a program load and use it.
Since this code:
perl6 -e 'say $*REPO'
outputs:
inst#/home/nando/.perl6
I thought that putting the .pm6 file in there would be enough. So,
since my module is A::B, I put B.pm6 into ~/.perl6/A .
But when I run a test program which loads A::B, I receive this error:
===SORRY!===
Could not find A::B at line 5 in:
/home/nando/.perl6
/home/nando/.rakudobrew/moar-2016.04/install/share/perl6/site
/home/nando/.rakudobrew/moar-2016.04/install/share/perl6/vendor
/home/nando/.rakudobrew/moar-2016.04/install/share/perl6
CompUnit::Repository::AbsolutePath<140256602878904>
CompUnit::Repository::NQP<140256602876152>
CompUnit::Repository::Perl5<140256602873560>
If I run the test program this way it works:
perl6 -I ~/.perl6 ./test.p6
Why is that? Where should I put the module file to be seen
automatically, without adding the -I option?
As a side note, if I want to precompile the module, as panda does
when installing new modules from the repository, where should I
put the .moarvm file?
Thanks!
--
Fernando Santagata