Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 9e5350d8b5
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (23 sloc) 0.761 kB
class NieczaPathSearch;
has @.path;
# Given Foo::Bar, find ($?FILE, $?ORIG)
method load_module($name) {
my $sub = "".IO.combine($name.split('::'));
my @path = ($*unit ?? $*unit.get_incs !! ()), @!path;
for @path -> $pe {
for <pm6 pm setting> -> $ext {
my $fn = $pe.IO.append($sub).but-extension($ext);
if $fn.f {
my $text = $fn.slurp;
# check borrowed from STD to weed out Perl 5 heuristically
next if $ext eq 'pm' && $text ~~ /^^\h*package\h+\w+\s*\;/;
return ~$fn.realpath, $text;
}
}
}
die "Unable to locate module $name in @path[]";
}
method load_file($name) {
my $p = $name.IO;
(~$p.realpath, $p.slurp);
}
Jump to Line
Something went wrong with that request. Please try again.