blib/lib/FFI/Me.pm

filter: Statementstmt 100% 48 / 48 Branchbran 100% 8 / 8 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 94.6% 71 / 75 CC 7 SCAR 11.9
CC
7
Cov
97%
ffi
6.0
__ANON__
2.0
BEGIN
1.0
CRAP 3.3
↑ Summary
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
BranchTrueFalseTotal
unless exists $args{"sym"} and defined $args{"sym"} 2 1 3
Condition66%2/3
exists $args{"sym"} and defined $args{"sym"}
!ll&&!rl&&r
201
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"}
ABresult
0X0
100
111
20 3 ▶ $args{rv} = ffi::void() if !exists $args{rv} || !defined $args{rv};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args{"rv"} and defined $args{"rv"} 1 2 3
Condition66%2/3
exists $args{"rv"} and defined $args{"rv"}
!ll&&!rl&&r
102
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"}
ABresult
0X0
100
111
21 3 ▶ $args{arg} = [] if !exists $args{arg};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args{"arg"} 1 2 3
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
BranchTrueFalseTotal
if $args{"method"} 1 1 2
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__
↑ Summary