I have a function written in a module file (.pm
), and want to use it in a Perl6 file (.pl6
). The two files are in the same folder:
C:\Users\Christian\Dropbox\ChristianPrivatefiler\Programmering\Perl6\perlCode
I tried to use the answer to Perl6: implicit and explicit import but my code returned this error:
===SORRY!=== Could not find chrmodule1 at line 5 in:
C:\Users\Christian\Dropbox\ChristianPrivatefiler\Programmering\Perl6\modules
C:\Users\Christian\.perl6
C:\rakudo\share\perl6\site
C:\rakudo\share\perl6\vendor
C:\rakudo\share\perl6
CompUnit::Repository::AbsolutePath<84241584>
CompUnit::Repository::NQP<86530680>
CompUnit::Repository::Perl5<86530720> [Finished in 0.436s]
Here is the .pm
file, chrmodule1.pm
:
module chrmodule1 {
sub foo is export(:DEFAULT, :one) {
say 'in foo';
}
}
Here is the .pl6
file, testOfCode3.pl6
:
use v6;
use lib 'modules';
use chrmodule1;
foo();
- I use this editor: atom.io
- Here is another solution to the problem that returned the same error when I tried it: perl6maven.com/tutorial/perl6-modules-export
The desired result was:
in foo [Finished in 0.317s]