line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::Module::Exports; |
2
|
|
|
|
|
|
|
|
3
|
22
|
|
|
22
|
|
150
|
use strict; |
|
22
|
|
|
|
|
124
|
|
|
22
|
|
|
|
|
661
|
|
4
|
22
|
|
|
22
|
|
114
|
use warnings; |
|
22
|
|
|
|
|
43
|
|
|
22
|
|
|
|
|
493
|
|
5
|
22
|
|
|
22
|
|
333
|
use 5.008004; |
|
22
|
|
|
|
|
78
|
|
6
|
22
|
|
|
22
|
|
202
|
use Carp (); |
|
22
|
|
|
|
|
55
|
|
|
22
|
|
|
|
|
456
|
|
7
|
22
|
|
|
22
|
|
12136
|
use Hash::Util (); |
|
22
|
|
|
|
|
63217
|
|
|
22
|
|
|
|
|
2818
|
|
8
|
|
|
|
|
|
|
use overload |
9
|
|
|
|
|
|
|
'%{}' => sub { |
10
|
4
|
|
|
4
|
|
1384
|
my $self = shift; |
11
|
4
|
|
|
|
|
8
|
my $module = $$self; |
12
|
4
|
|
|
|
|
23
|
$module->{exports}; |
13
|
|
|
|
|
|
|
}, |
14
|
|
|
|
|
|
|
'@{}' => sub { |
15
|
57
|
|
|
57
|
|
782
|
my $self = shift; |
16
|
57
|
|
|
|
|
145
|
my $module = $$self; |
17
|
57
|
|
|
|
|
234
|
my @exports = $module->_exports; |
18
|
57
|
|
|
|
|
267
|
Internals::SvREADONLY @exports, 1; |
19
|
57
|
|
|
|
|
318
|
Internals::SvREADONLY $exports[$_], 1 for 0..$#exports; |
20
|
57
|
|
|
|
|
248
|
\@exports; |
21
|
|
|
|
|
|
|
}, |
22
|
0
|
|
|
0
|
|
0
|
bool => sub { 1 }, |
23
|
22
|
|
|
22
|
|
227
|
fallback => 1; |
|
22
|
|
|
|
|
123
|
|
|
22
|
|
|
|
|
418
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime module exports class |
26
|
|
|
|
|
|
|
our $VERSION = '0.21'; # VERSION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new |
30
|
|
|
|
|
|
|
{ |
31
|
57
|
|
|
57
|
0
|
219
|
my($class, $module) = @_; |
32
|
|
|
|
|
|
|
|
33
|
57
|
|
66
|
|
|
255
|
$module->{exports} ||= do { |
34
|
38
|
|
|
|
|
230
|
my @exports = $module->_exports; |
35
|
38
|
|
|
|
|
98
|
my %exports; |
36
|
38
|
|
|
|
|
101
|
foreach my $export (@exports) |
37
|
|
|
|
|
|
|
{ |
38
|
71
|
|
|
|
|
520
|
$exports{$export->name} = $export->type; |
39
|
|
|
|
|
|
|
} |
40
|
38
|
|
|
|
|
453
|
Hash::Util::lock_hash(%exports); |
41
|
38
|
|
|
|
|
932
|
\%exports; |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
57
|
|
|
|
|
673
|
bless \$module, $class; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub can |
48
|
|
|
|
|
|
|
{ |
49
|
10
|
|
|
10
|
0
|
24775
|
my($self, $name) = @_; |
50
|
10
|
|
|
|
|
95
|
my $module = $$self; |
51
|
|
|
|
|
|
|
exists $module->{exports}->{$name} |
52
|
0
|
|
|
0
|
|
0
|
? sub { $self->$name } |
53
|
10
|
100
|
|
|
|
84
|
: $self->SUPER::can($name); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub AUTOLOAD |
57
|
|
|
|
|
|
|
{ |
58
|
7
|
|
|
7
|
|
170
|
our $AUTOLOAD; |
59
|
7
|
|
|
|
|
13
|
my $self = shift; |
60
|
|
|
|
|
|
|
|
61
|
7
|
|
|
|
|
14
|
my $name = $AUTOLOAD; |
62
|
7
|
|
|
|
|
45
|
$name=~ s/^.*:://; |
63
|
|
|
|
|
|
|
|
64
|
7
|
|
|
|
|
19
|
my $module = $$self; |
65
|
7
|
50
|
|
|
|
26
|
Carp::croak("no export $name") unless exists $module->{exports}->{$name}; |
66
|
7
|
|
|
|
|
22
|
$module->{exports}->{$name}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub DESTROY |
70
|
|
|
|
0
|
|
|
{ |
71
|
|
|
|
|
|
|
# needed because of AUTOLOAD |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |