| 1 | package FFI::Me; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use FFI::Raw (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | $FFI::Me::VERSION = '0.01'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 3 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 3 | my $caller = caller(); | |||||||||||||||||||||||||||
| 11 | 2 | ▶ | no strict 'refs'; ## no critic | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 3 | *{ $caller . '::ffi' } = \&ffi; | |||||||||||||||||||||||||||
| 13 | 3 | return; | |||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 3 | ▶ | sub ffi { | ||||||||||||||||||||||||||
|
Subroutine
ffi: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 17 | 3 | my ( $name, %args ) = @_; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 3 | ▶ | $args{sym} = $name if !exists $args{sym} || !defined $args{sym}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $args{"sym"} and defined $args{"sym"}
MC/DC50%1/2
exists $args{"sym"} and defined $args{"sym"}
exists $args{"sym"}
defined $args{"sym"}
Truth table66%2/3
A and B
A= exists $args{"sym"}B= defined $args{"sym"}
| |||||||||||||||||||||||||||||
| 20 | 3 | ▶ | $args{rv} = ffi::void() if !exists $args{rv} || !defined $args{rv}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $args{"rv"} and defined $args{"rv"}
MC/DC50%1/2
exists $args{"rv"} and defined $args{"rv"}
exists $args{"rv"}
defined $args{"rv"}
Truth table66%2/3
A and B
A= exists $args{"rv"}B= defined $args{"rv"}
| |||||||||||||||||||||||||||||
| 21 | 3 | ▶ | $args{arg} = [] if !exists $args{arg}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 3 | my $code = FFI::Raw->new( $args{lib}, $args{sym}, $args{rv}, @{ $args{arg} } ); | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 2 | my $caller = caller(); | |||||||||||||||||||||||||||
| 26 | 2 | ▶ | no strict 'refs'; ## no critic | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 2 | ▶ | *{ $caller . '::' . $name } = sub { shift if $args{method}; return $code->call(@_) }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 2 | return; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 2 | *ffi::void = \&FFI::Raw::void; | |||||||||||||||||||||||||||
| 33 | 2 | *ffi::int = \&FFI::Raw::int; | |||||||||||||||||||||||||||
| 34 | 2 | *ffi::uint = \&FFI::Raw::uint; | |||||||||||||||||||||||||||
| 35 | 2 | *ffi::short = \&FFI::Raw::short; | |||||||||||||||||||||||||||
| 36 | 2 | *ffi::ushort = \&FFI::Raw::ushort; | |||||||||||||||||||||||||||
| 37 | 2 | *ffi::long = \&FFI::Raw::long; | |||||||||||||||||||||||||||
| 38 | 2 | *ffi::ulong = \&FFI::Raw::ulong; | |||||||||||||||||||||||||||
| 39 | 2 | *ffi::int64 = \&FFI::Raw::int64; | |||||||||||||||||||||||||||
| 40 | 2 | *ffi::uint64 = \&FFI::Raw::uint64; | |||||||||||||||||||||||||||
| 41 | 2 | *ffi::char = \&FFI::Raw::char; | |||||||||||||||||||||||||||
| 42 | 2 | *ffi::uchar = \&FFI::Raw::uchar; | |||||||||||||||||||||||||||
| 43 | 2 | *ffi::float = \&FFI::Raw::float; | |||||||||||||||||||||||||||
| 44 | 2 | *ffi::double = \&FFI::Raw::double; | |||||||||||||||||||||||||||
| 45 | 2 | *ffi::str = \&FFI::Raw::str; | |||||||||||||||||||||||||||
| 46 | 2 | *ffi::ptr = \&FFI::Raw::ptr; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 2 | 1; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | __END__ | ||||||||||||||||||||||||||||