line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::Module::Imports; |
2
|
|
|
|
|
|
|
|
3
|
22
|
|
|
22
|
|
163
|
use strict; |
|
22
|
|
|
|
|
50
|
|
|
22
|
|
|
|
|
668
|
|
4
|
22
|
|
|
22
|
|
112
|
use warnings; |
|
22
|
|
|
|
|
41
|
|
|
22
|
|
|
|
|
499
|
|
5
|
22
|
|
|
22
|
|
350
|
use 5.008004; |
|
22
|
|
|
|
|
77
|
|
6
|
22
|
|
|
22
|
|
123
|
use Carp (); |
|
22
|
|
|
|
|
42
|
|
|
22
|
|
|
|
|
405
|
|
7
|
22
|
|
|
22
|
|
110
|
use Hash::Util (); |
|
22
|
|
|
|
|
54
|
|
|
22
|
|
|
|
|
3583
|
|
8
|
|
|
|
|
|
|
use overload |
9
|
|
|
|
|
|
|
'%{}' => sub { |
10
|
4
|
|
|
4
|
|
1165
|
my $self = shift; |
11
|
4
|
|
|
|
|
6
|
my $module = $$self; |
12
|
4
|
|
|
|
|
24
|
$module->{imports}; |
13
|
|
|
|
|
|
|
}, |
14
|
|
|
|
|
|
|
'@{}' => sub { |
15
|
47
|
|
|
47
|
|
652
|
my $self = shift; |
16
|
47
|
|
|
|
|
125
|
my $module = $$self; |
17
|
47
|
|
|
|
|
155
|
my @imports = $module->_imports; |
18
|
47
|
|
|
|
|
230
|
Internals::SvREADONLY @imports, 1; |
19
|
47
|
|
|
|
|
247
|
Internals::SvREADONLY $imports[$_], 1 for 0..$#imports; |
20
|
47
|
|
|
|
|
204
|
\@imports; |
21
|
|
|
|
|
|
|
}, |
22
|
0
|
|
|
0
|
|
0
|
bool => sub { 1 }, |
23
|
22
|
|
|
22
|
|
167
|
fallback => 1; |
|
22
|
|
|
|
|
53
|
|
|
22
|
|
|
|
|
253
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime module imports class |
26
|
|
|
|
|
|
|
our $VERSION = '0.21'; # VERSION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new |
30
|
|
|
|
|
|
|
{ |
31
|
44
|
|
|
44
|
0
|
137
|
my($class, $module) = @_; |
32
|
|
|
|
|
|
|
|
33
|
44
|
|
33
|
|
|
232
|
$module->{imports} ||= do { |
34
|
44
|
|
|
|
|
164
|
my @imports = $module->_imports; |
35
|
44
|
|
|
|
|
294
|
my %imports; |
36
|
44
|
|
|
|
|
125
|
foreach my $export (@imports) |
37
|
|
|
|
|
|
|
{ |
38
|
22
|
|
|
|
|
115
|
$imports{$export->name} = $export->type; |
39
|
|
|
|
|
|
|
} |
40
|
44
|
|
|
|
|
380
|
Hash::Util::lock_hash(%imports); |
41
|
44
|
|
|
|
|
1197
|
\%imports; |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
44
|
|
|
|
|
588
|
bless \$module, $class; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub can |
48
|
|
|
|
|
|
|
{ |
49
|
3
|
|
|
3
|
0
|
19453
|
my($self, $name) = @_; |
50
|
3
|
|
|
|
|
30
|
my $module = $$self; |
51
|
|
|
|
|
|
|
exists $module->{imports}->{$name} |
52
|
0
|
|
|
0
|
|
0
|
? sub { $self->$name } |
53
|
3
|
100
|
|
|
|
25
|
: $self->SUPER::can($name); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub AUTOLOAD |
57
|
|
|
|
|
|
|
{ |
58
|
1
|
|
|
1
|
|
22
|
our $AUTOLOAD; |
59
|
1
|
|
|
|
|
3
|
my $self = shift; |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
2
|
my $name = $AUTOLOAD; |
62
|
1
|
|
|
|
|
7
|
$name=~ s/^.*:://; |
63
|
|
|
|
|
|
|
|
64
|
1
|
|
|
|
|
3
|
my $module = $$self; |
65
|
1
|
50
|
|
|
|
5
|
Carp::croak("no export $name") unless exists $module->{imports}->{$name}; |
66
|
1
|
|
|
|
|
4
|
$module->{imports}->{$name}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub DESTROY |
70
|
|
|
|
0
|
|
|
{ |
71
|
|
|
|
|
|
|
# needed because of AUTOLOAD |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |