| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::Module::Imports; |
|
2
|
|
|
|
|
|
|
|
|
3
|
22
|
|
|
22
|
|
165
|
use strict; |
|
|
22
|
|
|
|
|
57
|
|
|
|
22
|
|
|
|
|
696
|
|
|
4
|
22
|
|
|
22
|
|
131
|
use warnings; |
|
|
22
|
|
|
|
|
57
|
|
|
|
22
|
|
|
|
|
559
|
|
|
5
|
22
|
|
|
22
|
|
377
|
use 5.008004; |
|
|
22
|
|
|
|
|
86
|
|
|
6
|
22
|
|
|
22
|
|
188
|
use Carp (); |
|
|
22
|
|
|
|
|
48
|
|
|
|
22
|
|
|
|
|
413
|
|
|
7
|
22
|
|
|
22
|
|
132
|
use Hash::Util (); |
|
|
22
|
|
|
|
|
55
|
|
|
|
22
|
|
|
|
|
3677
|
|
|
8
|
|
|
|
|
|
|
use overload |
|
9
|
|
|
|
|
|
|
'%{}' => sub { |
|
10
|
4
|
|
|
4
|
|
1515
|
my $self = shift; |
|
11
|
4
|
|
|
|
|
7
|
my $module = $$self; |
|
12
|
4
|
|
|
|
|
37
|
$module->{imports}; |
|
13
|
|
|
|
|
|
|
}, |
|
14
|
|
|
|
|
|
|
'@{}' => sub { |
|
15
|
47
|
|
|
47
|
|
784
|
my $self = shift; |
|
16
|
47
|
|
|
|
|
106
|
my $module = $$self; |
|
17
|
47
|
|
|
|
|
172
|
my @imports = $module->_imports; |
|
18
|
47
|
|
|
|
|
261
|
Internals::SvREADONLY @imports, 1; |
|
19
|
47
|
|
|
|
|
253
|
Internals::SvREADONLY $imports[$_], 1 for 0..$#imports; |
|
20
|
47
|
|
|
|
|
199
|
\@imports; |
|
21
|
|
|
|
|
|
|
}, |
|
22
|
0
|
|
|
0
|
|
0
|
bool => sub { 1 }, |
|
23
|
22
|
|
|
22
|
|
172
|
fallback => 1; |
|
|
22
|
|
|
|
|
59
|
|
|
|
22
|
|
|
|
|
340
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime module imports class |
|
26
|
|
|
|
|
|
|
our $VERSION = '0.23'; # VERSION |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
44
|
|
|
44
|
0
|
152
|
my($class, $module) = @_; |
|
32
|
|
|
|
|
|
|
|
|
33
|
44
|
|
33
|
|
|
244
|
$module->{imports} ||= do { |
|
34
|
44
|
|
|
|
|
284
|
my @imports = $module->_imports; |
|
35
|
44
|
|
|
|
|
159
|
my %imports; |
|
36
|
44
|
|
|
|
|
116
|
foreach my $export (@imports) |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
22
|
|
|
|
|
109
|
$imports{$export->name} = $export->type; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
44
|
|
|
|
|
345
|
Hash::Util::lock_hash(%imports); |
|
41
|
44
|
|
|
|
|
1073
|
\%imports; |
|
42
|
|
|
|
|
|
|
}; |
|
43
|
|
|
|
|
|
|
|
|
44
|
44
|
|
|
|
|
625
|
bless \$module, $class; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub can |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
3
|
|
|
3
|
0
|
23206
|
my($self, $name) = @_; |
|
50
|
3
|
|
|
|
|
29
|
my $module = $$self; |
|
51
|
|
|
|
|
|
|
exists $module->{imports}->{$name} |
|
52
|
0
|
|
|
0
|
|
0
|
? sub { $self->$name } |
|
53
|
3
|
100
|
|
|
|
34
|
: $self->SUPER::can($name); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub AUTOLOAD |
|
57
|
|
|
|
|
|
|
{ |
|
58
|
1
|
|
|
1
|
|
29
|
our $AUTOLOAD; |
|
59
|
1
|
|
|
|
|
2
|
my $self = shift; |
|
60
|
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
5
|
my $name = $AUTOLOAD; |
|
62
|
1
|
|
|
|
|
7
|
$name=~ s/^.*:://; |
|
63
|
|
|
|
|
|
|
|
|
64
|
1
|
|
|
|
|
5
|
my $module = $$self; |
|
65
|
1
|
50
|
|
|
|
6
|
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__ |