/
Perl5.pm6
55 lines (47 loc) · 1.52 KB
/
Perl5.pm6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class CompUnit::Repository::Perl5 does CompUnit::Repository {
method need(
CompUnit::DependencySpecification $spec,
CompUnit::PrecompilationRepository $precomp = self.precomp-repository(),
--> CompUnit:D)
{
if $spec.from eq 'Perl5' {
require Inline::Perl5;
my $perl5 = ::('Inline::Perl5').default_perl5;
if $*RAKUDO_MODULE_DEBUG -> $RMD {
$RMD("Loading {$spec.short-name} via Inline::Perl5");
}
my $handle := $perl5.require(
$spec.short-name,
$spec.version-matcher !== True ?? $spec.version-matcher.Num !! Num,
:handle
);
return CompUnit.new(
:short-name($spec.short-name),
:$handle,
:repo(self),
:repo-id($spec.short-name),
:from($spec.from),
);
CATCH {
when X::CompUnit::UnsatisfiedDependency {
X::NYI::Available.new(:available('Inline::Perl5'), :feature('Perl 5')).throw;
}
}
}
return self.next-repo.need($spec, $precomp) if self.next-repo;
X::CompUnit::UnsatisfiedDependency.new(:specification($spec)).throw;
}
method loaded() {
[]
}
method id() {
'Perl5'
}
method path-spec() {
'perl5#'
}
multi method gist(CompUnit::Repository::Perl5:D:) {
self.path-spec
}
}
# vim: ft=perl6 expandtab sw=4