| 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
| |||||||||||||||||||||||||||||||||
| 13 | : $target =~ /[^0-9]/ ? ($target) | ||||||||||||||||||||||||||||||||
| 14 | : (undef, undef, undef, $target); | ||||||||||||||||||||||||||||||||
| 15 | 6 | ▶ | if (defined $level) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 16 | 2 | my ($p, $fn, $ln) = caller($level + 2); | |||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | $package ||= $p; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$package ||= $p
MC/DC0%0/2
$package ||= $p
$package
$p
Truth table33%1/3
A ||= B
A= $packageB= $p
| |||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | $file ||= $fn; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$file ||= $fn
MC/DC0%0/2
$file ||= $fn
$file
$fn
Truth table33%1/3
A ||= B
A= $fileB= $fn
| |||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | $line ||= $ln; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$line ||= $ln
MC/DC0%0/2
$line ||= $ln
$line
$ln
Truth table33%1/3
A ||= B
A= $lineB= $ln
| |||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||
| 21 | qq{package $package;\n} | ||||||||||||||||||||||||||||||||
| 22 | 6 | ▶ | . ($file ? "#line $line \"$file\"\n" : '') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 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'}
MC/DC50%1/2
ref $target && $target->{'version'}
ref $target
$target->{'version'}
Truth table66%2/3
A && B
A= ref $targetB= $target->{'version'}
| |||||||||||||||||||||||||||||||||
| 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
Condition66%2/3
ref $target and exists $target->{"version"}
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"}
| |||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||