line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::Module::Exports; |
2
|
|
|
|
|
|
|
|
3
|
22
|
|
|
22
|
|
161
|
use strict; |
|
22
|
|
|
|
|
52
|
|
|
22
|
|
|
|
|
654
|
|
4
|
22
|
|
|
22
|
|
172
|
use warnings; |
|
22
|
|
|
|
|
209
|
|
|
22
|
|
|
|
|
634
|
|
5
|
22
|
|
|
22
|
|
354
|
use 5.008004; |
|
22
|
|
|
|
|
88
|
|
6
|
22
|
|
|
22
|
|
122
|
use Carp (); |
|
22
|
|
|
|
|
76
|
|
|
22
|
|
|
|
|
446
|
|
7
|
22
|
|
|
22
|
|
12740
|
use Hash::Util (); |
|
22
|
|
|
|
|
67582
|
|
|
22
|
|
|
|
|
3053
|
|
8
|
|
|
|
|
|
|
use overload |
9
|
|
|
|
|
|
|
'%{}' => sub { |
10
|
4
|
|
|
4
|
|
1408
|
my $self = shift; |
11
|
4
|
|
|
|
|
20
|
my $module = $$self; |
12
|
4
|
|
|
|
|
33
|
$module->{exports}; |
13
|
|
|
|
|
|
|
}, |
14
|
|
|
|
|
|
|
'@{}' => sub { |
15
|
57
|
|
|
57
|
|
816
|
my $self = shift; |
16
|
57
|
|
|
|
|
140
|
my $module = $$self; |
17
|
57
|
|
|
|
|
318
|
my @exports = $module->_exports; |
18
|
57
|
|
|
|
|
223
|
Internals::SvREADONLY @exports, 1; |
19
|
57
|
|
|
|
|
372
|
Internals::SvREADONLY $exports[$_], 1 for 0..$#exports; |
20
|
57
|
|
|
|
|
269
|
\@exports; |
21
|
|
|
|
|
|
|
}, |
22
|
0
|
|
|
0
|
|
0
|
bool => sub { 1 }, |
23
|
22
|
|
|
22
|
|
176
|
fallback => 1; |
|
22
|
|
|
|
|
54
|
|
|
22
|
|
|
|
|
362
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime module exports class |
26
|
|
|
|
|
|
|
our $VERSION = '0.22'; # VERSION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new |
30
|
|
|
|
|
|
|
{ |
31
|
57
|
|
|
57
|
0
|
182
|
my($class, $module) = @_; |
32
|
|
|
|
|
|
|
|
33
|
57
|
|
66
|
|
|
253
|
$module->{exports} ||= do { |
34
|
38
|
|
|
|
|
162
|
my @exports = $module->_exports; |
35
|
38
|
|
|
|
|
105
|
my %exports; |
36
|
38
|
|
|
|
|
209
|
foreach my $export (@exports) |
37
|
|
|
|
|
|
|
{ |
38
|
71
|
|
|
|
|
922
|
$exports{$export->name} = $export->type; |
39
|
|
|
|
|
|
|
} |
40
|
38
|
|
|
|
|
436
|
Hash::Util::lock_hash(%exports); |
41
|
38
|
|
|
|
|
947
|
\%exports; |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
57
|
|
|
|
|
621
|
bless \$module, $class; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub can |
48
|
|
|
|
|
|
|
{ |
49
|
10
|
|
|
10
|
0
|
26501
|
my($self, $name) = @_; |
50
|
10
|
|
|
|
|
103
|
my $module = $$self; |
51
|
|
|
|
|
|
|
exists $module->{exports}->{$name} |
52
|
0
|
|
|
0
|
|
0
|
? sub { $self->$name } |
53
|
10
|
100
|
|
|
|
74
|
: $self->SUPER::can($name); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub AUTOLOAD |
57
|
|
|
|
|
|
|
{ |
58
|
7
|
|
|
7
|
|
173
|
our $AUTOLOAD; |
59
|
7
|
|
|
|
|
17
|
my $self = shift; |
60
|
|
|
|
|
|
|
|
61
|
7
|
|
|
|
|
14
|
my $name = $AUTOLOAD; |
62
|
7
|
|
|
|
|
64
|
$name=~ s/^.*:://; |
63
|
|
|
|
|
|
|
|
64
|
7
|
|
|
|
|
22
|
my $module = $$self; |
65
|
7
|
50
|
|
|
|
51
|
Carp::croak("no export $name") unless exists $module->{exports}->{$name}; |
66
|
7
|
|
|
|
|
25
|
$module->{exports}->{$name}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub DESTROY |
70
|
|
|
|
0
|
|
|
{ |
71
|
|
|
|
|
|
|
# needed because of AUTOLOAD |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |