blib/lib/Wasm/Wasmtime/Instance/Exports.pm

filter: Statementstmt 96.0% 49 / 51 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 78.5% 11 / 14 Podpod 0.0% 0 / 2 totaltotal 85.5% 65 / 76 CC 6 SCAR 5.5
CC
6
Cov
93%
new
3.0
can
2.0
AUTOLOAD
2.0
CRAP 1.7
« blib/lib/Wasm/Wasmtime/Module/Exports.pm ↑ Summary blib/lib/Wasm/Wasmtime/ValType.pm »
1 package Wasm::Wasmtime::Instance::Exports;
2  
3 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 ▶use 5.008004;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 15 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 15 ▶use Hash::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 use overload
9 15 ▶ '%{}' => sub {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
10 6 my $self = shift;
11 6 my $instance = $$self;
12 6 $instance->{exports};
13 },
14 23 ▶ '@{}' => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
15 23 my $self = shift;
16 23 my $instance = $$self;
17 23 my @exports = $instance->_exports;
18 23 Internals::SvREADONLY @exports, 1;
19 23 Internals::SvREADONLY $exports[$_], 1 for 0..$#exports;
20 23 \@exports;
21 },
22 0 ▶ bool => sub { 1 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 15 fallback => 1;
24  
25 # ABSTRACT: Wasmtime instance exports class
26 15 our $VERSION = '0.24'; # VERSION
27  
28  
29 sub new
30 30 ▶{
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
31 30 my($class, $instance) = @_;
32  
33 30 ▶ $instance->{exports} ||= do {
Condition66%2/3
$instance->{"exports"} ||= do { my(@exports) = $instance->_exports; my(@module_exports) = @{$instance->module->exports;}; my %exports; foreach my $i (0 .. $#exports) { $exports{$module_exports[$i]->name} = $exports[$i]; } ; &Hash::Util::lock_hash(\%exports); \%exports }
l!l&&r!l&&!r
1290
MC/DC0%0/2
$instance->{"exports"} ||= do { my(@exports) = $instance->_exports; my(@module_exports) = @{$instance->module->exports;}; my %exports; foreach my $i (0 .. $#exports) { $exports{$module_exports[$i]->name} = $exports[$i]; } ; &Hash::Util::lock_hash(\%exports); \%exports }
$instance->{"exports"} do { my(@exports) = $instance->_exports; my(@module_exports) = @{$instance->module->exports;}; my %exports; foreach my $i (0 .. $#exports) { $exports{$module_exports[$i]->name} = $exports[$i]; } ; &Hash::Util::lock_hash(\%exports); \%exports }
Truth table66%2/3
A ||= B
A= $instance->{"exports"}B= do { my(@exports) = $instance->_exports; my(@module_exports) = @{$instance->module->exports;}; my %exports; foreach my $i (0 .. $#exports) { $exports{$module_exports[$i]->name} = $exports[$i]; } ; &Hash::Util::lock_hash(\%exports); \%exports }
ABresult
1X1
011
000
34 29 my @exports = $instance->_exports;
35 29 my @module_exports = @{ $instance->module->exports };
36 29 my %exports;
37 29 foreach my $i (0..$#exports)
38 {
39 59 $exports{$module_exports[$i]->name} = $exports[$i];
40 }
41 29 Hash::Util::lock_hash(%exports);
42 29 \%exports;
43 };
44  
45 30 bless \$instance, $class;
46 }
47  
48 sub can
49 11 ▶{
Subroutine can: called CC=2 SCAR=7.0
Pod undocumented
50 11 my($self, $name) = @_;
51 11 my $instance = $$self;
52 exists $instance->{exports}->{$name}
53 0 ▶ ? sub { $self->$name }
Subroutine __ANON__: not called CC=1 SCAR=6.9
54 11 ▶ : $self->SUPER::can($name);
Branch: 1 branch
BranchTrueFalseTotal
exists $instance->{'exports'}{$name} ? : 9 2 11
55 }
56  
57 sub AUTOLOAD
58 12 ▶{
Subroutine AUTOLOAD: called CC=2 SCAR=7.0
59 12 our $AUTOLOAD;
60 12 my $self = shift;
61  
62 12 my $name = $AUTOLOAD;
63 12 $name=~ s/^.*:://;
64  
65 12 my $instance = $$self;
66 12 ▶ Carp::croak("no export $name") unless exists $instance->{exports}->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $instance->{"exports"}{$name} 0 12 12
67 12 $instance->{exports}->{$name};
68 }
69  
70 sub DESTROY
71 0 ▶{
Subroutine DESTROY: not called CC=1 SCAR=0.0
72 # needed because of AUTOLOAD
73 }
74  
75  
76 15 1;
77  
78 __END__
« blib/lib/Wasm/Wasmtime/Module/Exports.pm ↑ Summary blib/lib/Wasm/Wasmtime/ValType.pm »