blib/lib/Import/Into.pm

filter: Statementstmt 92.5% 25 / 27 Branchbran 91.6% 11 / 12 Conditioncond 46.6% 7 / 15 MC/DCmcdc 20.0% 2 / 10 Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 71.8% 51 / 71 CC 12 SCAR 17.4
CC
12
Cov
80%
_prelude
8.8
_make_action
5.3
out_of
2.0
CRAP 5.7
↑ 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.002005';
8  
9 6 ▶sub _prelude {
Subroutine _prelude: called CC=8 SCAR=21.7
10 6 my $target = shift;
11 my ($package, $file, $line, $level)
12 6 ▶ = ref $target ? @{$target}{qw(package filename line level)}
Branch: 2 branches
BranchTrueFalseTotal
ref $target ? : 2 4 6
$target =~ /[^0-9]/ ? : 3 1 4
13 : $target =~ /[^0-9]/ ? ($target)
14 : (undef, undef, undef, $target);
15 6 ▶ if (defined $level) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $level) 2 4 6
16 2 my ($p, $fn, $ln) = caller($level + 2);
17 2 ▶ $package ||= $p;
Condition33%1/3
$package ||= $p
l!l&&r!l&&!r
020
MC/DC0%0/2
$package ||= $p
$package $p
Truth table33%1/3
A ||= B
A= $packageB= $p
ABresult
1X1
011
000
18 2 ▶ $file ||= $fn;
Condition33%1/3
$file ||= $fn
l!l&&r!l&&!r
020
MC/DC0%0/2
$file ||= $fn
$file $fn
Truth table33%1/3
A ||= B
A= $fileB= $fn
ABresult
1X1
011
000
19 2 ▶ $line ||= $ln;
Condition33%1/3
$line ||= $ln
l!l&&r!l&&!r
020
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 6 ▶ . ($file ? "#line $line \"$file\"\n" : '')
Branch: 1 branch
BranchTrueFalseTotal
$file ? : 3 3 6
23 }
24  
25 6 ▶sub _make_action {
Subroutine _make_action: called CC=5 SCAR=16.7
26 6 my ($action, $target) = @_;
27 6 ▶ my $version = ref $target && $target->{version};
Condition66%2/3
ref $target && $target->{'version'}
!ll&&!rl&&r
402
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 eval _prelude($target)
29 . q[sub {]
30 . q[ my $module = shift;]
31 . q[ Module::Runtime::require_module($module);]
32 6 ▶ . (ref $target && exists $target->{version} ? q[ $module->VERSION($version);] : q[])
Branch: 2 branches
BranchTrueFalseTotal
eval _prelude($target) . 'sub {' . " my \$module = shift;" . ' Module::Runtime::require_module($module);' . (ref $target && exists $target->{"version"} ? " \$module->VERSION(\$version);" : "") . ' $module->' . $action . '(@_);' . "}" or die "Failed to build action sub to $action for ${target}: $@" 6 0 6
ref $target && exists $target->{'version'} ? : 2 4 6
Condition66%2/3
ref $target and exists $target->{"version"}
!ll&&!rl&&r
402
MC/DC50%1/2
ref $target and exists $target->{"version"}
ref $target exists $target->{"version"}
Truth table66%2/3
A and B
A= ref $targetB= exists $target->{"version"}
ABresult
0X0
100
111
33 . q[ $module->].$action.q[(@_);]
34 . q[}]
35 or die "Failed to build action sub to ${action} for ${target}: $@";
36 }
37  
38 6 ▶sub import::into {
Subroutine into: called CC=1 SCAR=0.0
39 6 my ($class, $target, @args) = @_;
40 6 _make_action(import => $target)->($class, @args);
41 }
42  
43 0 ▶sub unimport::out_of {
Subroutine out_of: not called CC=1 SCAR=6.9
44 0 my ($class, $target, @args) = @_;
45 0 _make_action(unimport => $target)->($class, @args);
46 }
47  
48 1 1;
49  
50 __END__
↑ Summary