| 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 Wasm::Wasmtime::FFI; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 10 | ▶ | use Wasm::Wasmtime::Extern; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 10 | ▶ | use base qw( Exporter ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 10 | our @EXPORT = qw( wasmtime_caller ); | |||||||||||
| 11 | |||||||||||||
| 12 | 10 | $ffi_prefix = 'wasmtime_caller_'; | |||||||||||
| 13 | 10 | $ffi->load_custom_type('::PtrObject' => 'wasmtime_caller_t' => __PACKAGE__); | |||||||||||
| 14 | |||||||||||||
| 15 | # ABSTRACT: Wasmtime caller interface | ||||||||||||
| 16 | 10 | our $VERSION = '0.23'; # VERSION | |||||||||||
| 17 | |||||||||||||
| 18 | |||||||||||||
| 19 | 10 | our @callers; | |||||||||||
| 20 | |||||||||||||
| 21 | sub wasmtime_caller (;$) | ||||||||||||
| 22 | { | ||||||||||||
| 23 | 4 | ▶ | $callers[$_[0]||0] | ||||||||||
|
Subroutine
wasmtime_caller: called CC=2 SCAR=7.6
Pod
documented
Condition50%1/2
$_[0] || 0
MC/DC0%0/1
$_[0] || 0
$_[0]
Truth table50%1/2
A
A= $_[0]
| |||||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | |||||||||||||
| 27 | sub new | ||||||||||||
| 28 | { | ||||||||||||
| 29 | 11 | ▶ | my($class, $ptr) = @_; | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 30 | 11 | bless { | |||||||||||
| 31 | ptr => $ptr, | ||||||||||||
| 32 | }, $class; | ||||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | $ffi->attach( export_get => ['wasmtime_caller_t','wasm_byte_vec_t*'] => 'wasm_extern_t' => sub { | ||||||||||||
| 36 | 3 | ▶ | my $xsub = shift; | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||
| 37 | 3 | my $self = shift; | |||||||||||
| 38 | 3 | ▶ | return undef unless $self->{ptr}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 39 | 2 | my $name = Wasm::Wasmtime::ByteVec->new($_[0]); | |||||||||||
| 40 | 2 | $xsub->($self, $name); | |||||||||||
| 41 | 10 | }); | |||||||||||
| 42 | |||||||||||||
| 43 | 10 | 1; | |||||||||||
| 44 | |||||||||||||
| 45 | __END__ | ||||||||||||