/usr/local/lib/perl5/5.44.0/Exporter.pm

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 40 MC/DCmcdc 0.0% 0 / 19 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 140 CC 29 SCAR 65.3
CC
29
Cov
0%
import
870.0
as_heavy
2.0
export
2.0
CRAP 682.3
« /usr/local/lib/perl5/5.44.0/constant.pm ↑ Summary /usr/local/lib/perl5/5.44.0/B/Deparse.pm »
1 package Exporter;
2  
3 use strict;
4 no strict 'refs';
5  
6 our $Debug = 0;
7 our $ExportLevel = 0;
8 our $Verbose ||= 0;
9 our $VERSION = '5.79';
10 our %Cache;
11  
12 sub as_heavy {
13 0 ▶ require Exporter::Heavy;
Subroutine as_heavy: not called CC=1 SCAR=6.9
Pod undocumented
14 # Unfortunately, this does not work if the caller is aliased as *name = \&foo
15 # Thus the need to create a lot of identical subroutines
16 0 my $c = (caller(1))[3];
17 0 $c =~ s/.*:://;
18 0 \&{"Exporter::Heavy::heavy_$c"};
19 }
20  
21 sub export {
22 0 ▶ goto &{as_heavy()};
Subroutine export: not called CC=1 SCAR=6.9
Pod undocumented
23 }
24  
25 sub import {
26 0 ▶ my $pkg = shift;
Subroutine import: not called CC=29 SCAR=67.7
27 0 my $callpkg = caller($ExportLevel);
28  
29 0 ▶ if ($pkg eq "Exporter" and @_ and $_[0] eq "import") {
Branch: 1 branch
BranchTrueFalseTotal
if ($pkg eq "Exporter" and @_ and $_[0] eq "import") 0 0 0
Condition0%0/6
$pkg eq "Exporter" and @_ and $_[0] eq "import"
!ll&&!rl&&r
000
$pkg eq "Exporter" and @_
!ll&&!rl&&r
000
MC/DC0%0/3
$pkg eq "Exporter" and @_ and $_[0] eq "import"
$pkg eq "Exporter" @_ $_[0] eq "import"
Truth table0%0/4
A and B and C
A= $pkg eq "Exporter"B= @_C= $_[0] eq "import"
ABCresult
0XX0
10X0
1100
1111
30 0 *{$callpkg."::import"} = \&import;
31 0 return;
32 }
33  
34 # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-(
35 0 my $exports = \@{"$pkg\::EXPORT"};
36 # But, avoid creating things if they don't exist, which saves a couple of
37 # hundred bytes per package processed.
38 0 ▶ my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"};
Condition0%0/2
do { $pkg . '::' }->{'EXPORT_FAIL'} && \@{"${pkg}::EXPORT_FAIL";}
!ll
00
MC/DC0%0/1
do { $pkg . '::' }->{'EXPORT_FAIL'} && \@{"${pkg}::EXPORT_FAIL";}
do { $pkg . '::' }->{'EXPORT_FAIL'}
Truth table0%0/2
A
A= do { $pkg . '::' }->{'EXPORT_FAIL'}
Aresult
00
11
39 0 ▶ return export $pkg, $callpkg, @_
Branch: 1 branch
BranchTrueFalseTotal
if $Exporter::Verbose or $Exporter::Debug or $fail and @$fail > 1 0 0 0
Condition0%0/9
$Exporter::Verbose or $Exporter::Debug or $fail and @$fail > 1
l!l&&r!l&&!r
000
$Exporter::Verbose or $Exporter::Debug
l!l&&r!l&&!r
000
$fail and @$fail > 1
!ll&&!rl&&r
000
MC/DC0%0/4
$Exporter::Verbose or $Exporter::Debug or $fail and @$fail > 1
$Exporter::Verbose $Exporter::Debug $fail @$fail > 1
Truth table0%0/5
A or B or C and D
A= $Exporter::VerboseB= $Exporter::DebugC= $failD= @$fail > 1
ABCDresult
1XXX1
01XX1
00111
000X0
00100
40 if $Verbose or $Debug or $fail && @$fail > 1;
41 0 ▶ my $export_cache = ($Cache{$pkg} ||= {});
Condition0%0/2
$Exporter::Cache{$pkg} ||= {}
l!l
00
MC/DC0%0/1
$Exporter::Cache{$pkg} ||= {}
$Exporter::Cache{$pkg}
Truth table0%0/2
A
A= $Exporter::Cache{$pkg}
Aresult
11
00
42 0 ▶ my $args = @_ or @_ = @$exports;
Branch: 1 branch
BranchTrueFalseTotal
my $args = @_ or @_ = @$exports 0 0 0
43  
44 0 ▶ if ($args and not %$export_cache) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args and not %$export_cache) 0 0 0
Condition0%0/3
$args and not %$export_cache
!ll&&!rl&&r
000
MC/DC0%0/2
$args and not %$export_cache
$args not %$export_cache
Truth table0%0/3
A and not(B)
A= $argsB= not %$export_cache
ABresult
0X0
100
111
45 s/^&//, $export_cache->{$_} = 1
46 0 foreach (@$exports, @{"$pkg\::EXPORT_OK"});
47 }
48 0 my $heavy;
49 # Try very hard not to use {} and hence have to enter scope on the foreach
50 # We bomb out of the loop with last as soon as heavy is set.
51 0 ▶ if ($args or $fail) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args or $fail) { } 0 0 0
Condition0%0/3
$args or $fail
l!l&&r!l&&!r
000
MC/DC0%0/2
$args or $fail
$args $fail
Truth table0%0/3
A or B
A= $argsB= $fail
ABresult
1X1
011
000
52 ($heavy = (/\W/ or $args and not exists $export_cache->{$_}
53 or $fail and @$fail and $_ eq $fail->[0])) and last
54 0 ▶ foreach (@_);
Branch: 1 branch
BranchTrueFalseTotal
$heavy = /\W/ || $args && !exists $export_cache->{$_} || $fail && @$fail && $_ eq $fail->[0] and last 0 0 0
Condition0%0/15
/\W/ || $args && !exists $export_cache->{$_} || $fail && @$fail && $_ eq $fail->[0]
l!l&&r!l&&!r
000
/\W/ or $args and not exists $export_cache->{$_}
l!l&&r!l&&!r
000
$args and not exists $export_cache->{$_}
!ll&&!rl&&r
000
$fail and @$fail and $_ eq $fail->[0]
!ll&&!rl&&r
000
$fail and @$fail
!ll&&!rl&&r
000
MC/DC0%0/6
/\W/ || $args && !exists $export_cache->{$_} || $fail && @$fail && $_ eq $fail->[0]
/\W/ $args not exists $export_cache->{$_} $fail @$fail $_ eq $fail->[0]
Truth table0%0/10
A or B and not(C) || D and E and F
A= /\W/B= $argsC= not exists $export_cache->{$_}D= $failE= @$failF= $_ eq $fail->[0]
ABCDEFresult
1XXXXX1
011XXX1
00X1111
0101111
00X0XX0
00X10X0
00X1100
0100XX0
01010X0
0101100
55 } else {
56 ($heavy = /\W/) and last
57 0 ▶ foreach (@_);
Branch: 1 branch
BranchTrueFalseTotal
$heavy = /\W/ and last 0 0 0
58 }
59 0 ▶ return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
Branch: 2 branches
BranchTrueFalseTotal
if $heavy 0 0 0
$args ? : 0 0 0
60 local $SIG{__WARN__} =
61 0 ▶ sub {require Carp; &Carp::carp} if not $SIG{__WARN__};
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless $SIG{"__WARN__"} 0 0 0
62 # shortcut for the common case of no type character
63 0 *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_;
64 }
65  
66 # Default methods
67  
68 sub export_fail {
69 0 ▶ my $self = shift;
Subroutine export_fail: not called CC=1 SCAR=6.9
Pod undocumented
70 0 @_;
71 }
72  
73 # Unfortunately, caller(1)[3] "does not work" if the caller is aliased as
74 # *name = \&foo. Thus the need to create a lot of identical subroutines
75 # Otherwise we could have aliased them to export().
76  
77 sub export_to_level {
78 0 ▶ goto &{as_heavy()};
Subroutine export_to_level: not called CC=1 SCAR=6.9
Pod undocumented
79 }
80  
81 sub export_tags {
82 0 ▶ goto &{as_heavy()};
Subroutine export_tags: not called CC=1 SCAR=6.9
Pod undocumented
83 }
84  
85 sub export_ok_tags {
86 0 ▶ goto &{as_heavy()};
Subroutine export_ok_tags: not called CC=1 SCAR=6.9
Pod undocumented
87 }
88  
89 sub require_version {
90 0 ▶ goto &{as_heavy()};
Subroutine require_version: not called CC=1 SCAR=6.9
Pod undocumented
91 }
92  
93 1;
94 __END__
« /usr/local/lib/perl5/5.44.0/constant.pm ↑ Summary /usr/local/lib/perl5/5.44.0/B/Deparse.pm »