blib/lib/Import/Into.pm

filter: Statementstmt 92.8% 26 / 28 Branchbran 91.6% 11 / 12 Conditioncond 41.6% 5 / 12 MC/DCmcdc 12.5% 1 / 8 Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 73.1% 49 / 67 CC 11 SCAR 17.0
CC
11
Cov
81%
_prelude
8.8
_make_action
4.1
out_of
2.0
CRAP 5.5
↑ Summary
1 package Import::Into;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Module::Runtime;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '1.002004';
8  
9 sub _prelude {
10 5 ▶ my $target = shift;
Subroutine _prelude: called CC=8 SCAR=21.7
11 my ($package, $file, $line, $level)
12 5 ▶ = ref $target ? @{$target}{qw(package filename line)}
Branch: 2 branches
BranchTrueFalseTotal
ref $target ? : 1 4 5
$target =~ /[^0-9]/ ? : 3 1 4
13 : $target =~ /[^0-9]/ ? ($target)
14 : (undef, undef, undef, $target);
15 5 ▶ if (defined $level) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $level) 1 4 5
16 1 my ($p, $fn, $ln) = caller($level + 2);
17 1 ▶ $package ||= $p;
Condition33%1/3
$package ||= $p
l!l&&r!l&&!r
010
MC/DC0%0/2
$package ||= $p
$package $p
Truth table33%1/3
A ||= B
A= $packageB= $p
ABresult
1X1
011
000
18 1 ▶ $file ||= $fn;
Condition33%1/3
$file ||= $fn
l!l&&r!l&&!r
010
MC/DC0%0/2
$file ||= $fn
$file $fn
Truth table33%1/3
A ||= B
A= $fileB= $fn
ABresult
1X1
011
000
19 1 ▶ $line ||= $ln;
Condition33%1/3
$line ||= $ln
l!l&&r!l&&!r
010
MC/DC0%0/2
$line ||= $ln
$line $ln
Truth table33%1/3
A ||= B
A= $lineB= $ln
ABresult
1X1
011
000
20 }
21 qq{package $package;\n}
22 5 ▶ . ($file ? "#line $line \"$file\"\n" : '')
Branch: 1 branch
BranchTrueFalseTotal
$file ? : 2 3 5
23 }
24  
25 sub _make_action {
26 5 ▶ my ($action, $target) = @_;
Subroutine _make_action: called CC=4 SCAR=14.1
27 5 ▶ my $version = ref $target && $target->{version};
Condition66%2/3
ref $target && $target->{'version'}
!ll&&!rl&&r
401
MC/DC50%1/2
ref $target && $target->{'version'}
ref $target $target->{'version'}
Truth table66%2/3
A && B
A= ref $targetB= $target->{'version'}
ABresult
0X0
100
111
28 5 ▶ my $ver_check = $version ? ', $version' : '';
Branch: 1 branch
BranchTrueFalseTotal
$version ? : 1 4 5
29 5 ▶ eval _prelude($target)
Branch: 1 branch
BranchTrueFalseTotal
eval _prelude($target) . "sub { Module::Runtime::use_module( shift$ver_check )->$action(\@_) }" or die "Failed to build action sub to $action for ${target}: $@" 0 5 5
30 . qq{sub { Module::Runtime::use_module( shift$ver_check )->$action(\@_) }}
31 or die "Failed to build action sub to ${action} for ${target}: $@";
32 }
33  
34 sub import::into {
35 5 ▶ my ($class, $target, @args) = @_;
Subroutine into: called CC=1 SCAR=0.0
36 5 _make_action(import => $target)->($class, @args);
37 }
38  
39 sub unimport::out_of {
40 0 ▶ my ($class, $target, @args) = @_;
Subroutine out_of: not called CC=1 SCAR=6.9
41 0 _make_action(unimport => $target)->($class, @args);
42 }
43  
44 1 1;
45  
46 __END__
↑ Summary