| 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
| |||||||||||||||||||||
| 13 | : $target =~ /[^0-9]/ ? ($target) | ||||||||||||||||||||
| 14 | : (undef, undef, undef, $target); | ||||||||||||||||||||
| 15 | 5 | ▶ | if (defined $level) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 16 | 1 | my ($p, $fn, $ln) = caller($level + 2); | |||||||||||||||||||
| 17 | 1 | ▶ | $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 | 1 | ▶ | $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 | 1 | ▶ | $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 | 5 | ▶ | . ($file ? "#line $line \"$file\"\n" : '') | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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'}
MC/DC50%1/2
ref $target && $target->{'version'}
ref $target
$target->{'version'}
Truth table66%2/3
A && B
A= ref $targetB= $target->{'version'}
| |||||||||||||||||||||
| 28 | 5 | ▶ | my $ver_check = $version ? ', $version' : ''; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | 5 | ▶ | eval _prelude($target) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||