blib/lib/Wasm/Wasmtime/Caller.pm

filter: Statementstmt 97.5% 40 / 41 Branchbran 66.6% 4 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 90.9% 10 / 11 Podpod 66.6% 2 / 3 totaltotal 89.0% 57 / 64 CC 5 SCAR 7.1
CC
5
Cov
92%
__ANON__
4.0
wasmtime_caller
2.1
store
2.0
CRAP 2.0
« blib/lib/Wasm/Wasmtime/Memory.pm ↑ Summary blib/lib/Wasm/Table.pm »
1 package Wasm::Wasmtime::Caller;
2  
3 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use 5.008004;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use FFI::Platypus::Buffer ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 10 ▶use Wasm::Wasmtime::FFI;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use Wasm::Wasmtime::Extern;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 ▶use base qw( Exporter );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 10 our @EXPORT = qw( wasmtime_caller );
12  
13 10 $ffi_prefix = 'wasmtime_caller_';
14  
15 # ABSTRACT: Wasmtime caller interface
16 10 our $VERSION = '0.24'; # VERSION
17  
18  
19 10 our @callers;
20  
21 sub wasmtime_caller (;$)
22 4 ▶{
Subroutine wasmtime_caller: called CC=2 SCAR=7.6
Pod documented
23 4 ▶ $callers[$_[0]||0]
Condition50%1/2
$_[0] || 0
l!l
04
MC/DC0%0/1
$_[0] || 0
$_[0]
Truth table50%1/2
A
A= $_[0]
Aresult
11
00
24 }
25  
26  
27 sub new
28 11 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
29 11 my($class, $ptr, $store) = @_;
30 11 bless {
31 ptr => $ptr,
32 store => $store,
33 }, $class;
34 }
35  
36  
37 0 ▶sub store { shift->{store} }
Subroutine store: not called CC=1 SCAR=6.9
Pod documented
38  
39 3 ▶$ffi->attach( export_get => ['opaque','opaque','size_t','wasmtime_extern_t'] => 'bool' => sub {
Subroutine __ANON__: called CC=4 SCAR=13.9
40 3 my $xsub = shift;
41 3 my $self = shift;
42 3 ▶ return undef unless $self->{ptr};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"ptr"} 1 2 3
43 2 my $name = shift;
44 2 ▶ $name = defined $name ? "$name" : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 2 0 2
45 2 my($nptr, $nlen) = FFI::Platypus::Buffer::scalar_to_buffer($name);
46 2 my $extern = Wasm::Wasmtime::ExternData->new;
47 2 ▶ return undef unless $xsub->($self->{ptr}, $nptr, $nlen, $extern);
Branch: 1 branch
BranchTrueFalseTotal
unless &$xsub($self->{"ptr"}, $nptr, $nlen, $extern) 0 2 2
48 2 my $obj = Wasm::Wasmtime::Extern->from_extern($extern, $self->{store});
49 2 $extern->free;
50 2 $obj;
51 10 });
52  
53 10 1;
54  
55 __END__
« blib/lib/Wasm/Wasmtime/Memory.pm ↑ Summary blib/lib/Wasm/Table.pm »