blib/lib/Attribute/Handlers/Clean.pm

filter: Statementstmt 97.9% 384 / 392 Branchbran 74.4% 64 / 86 Conditioncond 58.1% 25 / 43 MC/DCmcdc 25.9% 7 / 27 Subroutinesub 98.9% 96 / 97 Podpod 100% 1 / 1 totaltotal 89.3% 577 / 646 CC 86 SCAR 20.1
CC
86
Cov
91%
import
23.2
__ANON__
20.6
findsym
10.4
CRAP 7.5
↑ Summary
1 package Attribute::Handlers::Clean;
2 4 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use attributes ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Perlmazing ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8
9 4 our $VERSION = '1.06'; # remember to update version in POD!
10 4 our $AUTOLOAD;
11
12 4 my %symcache;
13 74 ▶sub findsym {
Subroutine findsym: called CC=10 SCAR=23.4
Pod documented
14 74 my ($pkg, $ref, $type) = @_;
15 74 ▶ return $symcache{$pkg,$ref} if $symcache{$pkg,$ref};
Branch: 1 branch
BranchTrueFalseTotal
if $symcache{join $;, $pkg, $ref} 1 73 74
16 73 ▶ $type ||= ref($ref);
Condition33%1/3
$type ||= ref $ref
l!l&&r!l&&!r
0730
MC/DC0%0/2
$type ||= ref $ref
$type ref $ref
Truth table33%1/3
A ||= B
A= $typeB= ref $ref
ABresult
1X1
011
000
17 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 73 my $symtab = \%{$pkg."::"};
19 73 for (keys %$symtab) {
20 7438 for my $sym ($$symtab{$_}) {
21 7438 ▶ if (ref $sym && $sym == $ref) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $sym and $sym == $ref) 0 7438 7438
Condition66%2/3
ref $sym and $sym == $ref
!ll&&!rl&&r
743440
MC/DC0%0/2
ref $sym and $sym == $ref
ref $sym $sym == $ref
Truth table66%2/3
A and B
A= ref $symB= $sym == $ref
ABresult
0X0
100
111
22 0 return $symcache{$pkg,$ref} = \*{"$pkg:\:$_"};
23 }
24 4 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 7438 ▶ next unless ref (\$sym) eq 'GLOB';
Branch: 1 branch
BranchTrueFalseTotal
unless ref \$sym eq "GLOB" 4 7434 7438
26 return $symcache{$pkg,$ref} = \$sym
27 7434 ▶ if *{$sym}{$type} && *{$sym}{$type} == $ref;
Branch: 1 branch
BranchTrueFalseTotal
if *{$sym;}{$type} and *{$sym;}{$type} == $ref 39 7395 7434
Condition100%3/3
*{$sym;}{$type} and *{$sym;}{$type} == $ref
!ll&&!rl&&r
3683371239
MC/DC100%2/2
*{$sym;}{$type} and *{$sym;}{$type} == $ref
*{$sym;}{$type} *{$sym;}{$type} == $ref
Truth table100%3/3
A and B
A= *{$sym;}{$type}B= *{$sym;}{$type} == $ref
ABresult
0X0
100
111
28 }
29 }
30 }
31
32 4 my %validtype = (
33 VAR => [qw[SCALAR ARRAY HASH]],
34 ANY => [qw[SCALAR ARRAY HASH CODE]],
35 "" => [qw[SCALAR ARRAY HASH CODE]],
36 SCALAR => [qw[SCALAR]],
37 ARRAY => [qw[ARRAY]],
38 HASH => [qw[HASH]],
39 CODE => [qw[CODE]],
40 );
41 4 my %lastattr;
42 my @declarations;
43 4 my %raw;
44 4 my %phase;
45 4 my %sigil = (SCALAR=>'$', ARRAY=>'@', HASH=>'%');
46 4 my $global_phase = 0;
47 4 my %global_phases = (
48 BEGIN => 0,
49 CHECK => 1,
50 INIT => 2,
51 END => 3,
52 );
53 4 my @global_phases = qw(BEGIN CHECK INIT END);
54
55 0 ▶sub _usage_AH_ {
Subroutine _usage_AH_: not called CC=1 SCAR=6.9
56 0 croak "Usage: use $_[0] autotie => {AttrName => TieClassName,...}";
57 }
58
59 4 my $qual_id = qr/^[_a-z]\w*(::[_a-z]\w*)*$/i;
60
61 7 ▶sub import {
Subroutine import: called CC=20 SCAR=31.4
62 7 my $class = shift @_;
63 {
64 7 my @caller_0 = caller 0;
65 7 my @caller_1 = caller 1;
66 # Allow just calling "package->import" inside of subclses own import method, to mean their caller should get the same import effect from this module - in the same style of warnings->unimport
67 7 ▶ my $caller = (@caller_1 and $caller_1[3] eq "$caller_0[0]::import") ? $caller_1[0] : $caller_0[0];
Branch: 1 branch
BranchTrueFalseTotal
@caller_1 && $caller_1[3] eq "$caller_0[0]::import" ? : 0 7 7
Condition33%1/3
@caller_1 and $caller_1[3] eq "$caller_0[0]::import"
!ll&&!rl&&r
070
MC/DC0%0/2
@caller_1 and $caller_1[3] eq "$caller_0[0]::import"
@caller_1 $caller_1[3] eq "$caller_0[0]::import"
Truth table33%1/3
A and B
A= @caller_1B= $caller_1[3] eq "$caller_0[0]::import"
ABresult
0X0
100
111
68 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
69 7 warnings->unimport('reserved');
70 7 ▶ push (@{"${caller}::ISA"}, $class) unless $caller eq $class or grep {$_ eq $class} @{"${caller}::ISA"};
Branch: 1 branch
BranchTrueFalseTotal
unless $caller eq $class or grep {$_ eq $class;} @{"${caller}::ISA";} 6 1 7
Condition66%2/3
$caller eq $class or grep {$_ eq $class;} @{"${caller}::ISA";}
l!l&&r!l&&!r
016
MC/DC50%1/2
$caller eq $class or grep {$_ eq $class;} @{"${caller}::ISA";}
$caller eq $class grep {$_ eq $class;} @{"${caller}::ISA";}
Truth table66%2/3
A or B
A= $caller eq $classB= grep {$_ eq $class;} @{"${caller}::ISA";}
ABresult
1X1
011
000
71 7 for (@{$validtype{ANY}}) {
72 28 ▶ *{"${caller}::MODIFY_${_}_ATTRIBUTES"} = _gen_handler_AH_() unless defined *{"${caller}::MODIFY_${_}_ATTRIBUTES"};
Branch: 1 branch
BranchTrueFalseTotal
unless defined *{"${caller}::MODIFY_${_}_ATTRIBUTES";} 20 8 28
73 }
74 }
75 7 ▶ return unless $class eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
unless $class eq __PACKAGE__ 1 6 7
76 6 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 6 7
77 1 my $cmd = shift;
78 1 ▶ if ($cmd =~ /^autotie((?:ref)?)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmd =~ /^autotie((?:ref)?)$/) { } 1 0 1
79 1 ▶ my $tiedata = ($1 ? '$ref, ' : '') . '@$data';
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 0 1 1
80 1 my $mapping = shift;
81 1 ▶ _usage_AH_ $class unless ref($mapping) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $mapping eq "HASH" 0 1 1
82 1 ▶ while (my($attr, $tieclass) = each %$mapping) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$mapping) 3 1 4
83 3 $tieclass =~ s/^([_a-z]\w*(::[_a-z]\w*)*)(.*)/$1/is;
84 3 ▶ my $args = $3||'()';
Condition50%1/2
$3 || '()'
l!l
03
MC/DC0%0/1
$3 || '()'
$3
Truth table50%1/2
A
A= $3
Aresult
11
00
85 3 ▶ _usage_AH_ $class unless $attr =~ $qual_id && $tieclass =~ $qual_id && eval "use base q\0$tieclass\0; 1";
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /$qual_id/ and $tieclass =~ /$qual_id/ and eval "use base q\000$tieclass\000; 1" 0 3 3
Condition33%2/6
$attr =~ /$qual_id/ and $tieclass =~ /$qual_id/ and eval "use base q\000$tieclass\000; 1"
!ll&&!rl&&r
003
$attr =~ /$qual_id/ and $tieclass =~ /$qual_id/
!ll&&!rl&&r
003
MC/DC0%0/3
$attr =~ /$qual_id/ and $tieclass =~ /$qual_id/ and eval "use base q\000$tieclass\000; 1"
$attr =~ /$qual_id/ $tieclass =~ /$qual_id/ eval "use base q\000$tieclass\000; 1"
Truth table25%1/4
A and B and C
A= $attr =~ /$qual_id/B= $tieclass =~ /$qual_id/C= eval "use base q\000$tieclass\000; 1"
ABCresult
0XX0
10X0
1100
1111
86 3 ▶ if ($tieclass->isa('Exporter')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tieclass->isa("Exporter")) 0 3 3
87 0 local $Exporter::ExportLevel = 2;
88 0 $tieclass->import(eval $args);
89 }
90 0 $attr =~ s/__CALLER__/caller(1)/e;
91 3 ▶ $attr = caller()."::".$attr unless $attr =~ /::/;
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /::/ 2 1 3
92 3 ▶ eval '# line '.__LINE__.' "'.__FILE__.qq{"
Branch: 1 branch
BranchTrueFalseTotal
eval '# line 92 "/home/cpancover/.cpan/build/Attribute-Handlers-Clean-1.06-0/blib/lib/Attribute/Handlers/Clean.pm' . qq["\n sub $attr : ATTR(VAR) {\n my (\$ref, \$data) = \@_[2,4];\n my \$was_arrayref = ref \$data eq 'ARRAY';\n \$data = [ \$data ] unless \$was_arrayref;\n my \$type = ref(\$ref)||"value (".(\$ref||"<undef>").")";\n (\$type eq 'SCALAR') ?\n tie \$\$ref,'${tieclass}',$tiedata :\n (\$type eq 'ARRAY') ?\n tie \@\$ref,'${tieclass}',$tiedata :\n (\$type eq 'HASH') ?\n tie %\$ref,'${tieclass}',$tiedata :\n die "Can't autotie a \$type\n";\n } 1\n ] or die "Internal error: $@" 3 0 3
93 sub $attr : ATTR(VAR) {
94 my (\$ref, \$data) = \@_[2,4];
95 my \$was_arrayref = ref \$data eq 'ARRAY';
96 \$data = [ \$data ] unless \$was_arrayref;
97 my \$type = ref(\$ref)||"value (".(\$ref||"<undef>").")";
98 (\$type eq 'SCALAR') ?
99 tie \$\$ref,'$tieclass',$tiedata :
100 (\$type eq 'ARRAY') ?
101 tie \@\$ref,'$tieclass',$tiedata :
102 (\$type eq 'HASH') ?
103 tie \%\$ref,'$tieclass',$tiedata :
104 die "Can't autotie a \$type\n";
105 1 ▶ } 1
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
106 } or die "Internal error: $@";
107 }
108 } else {
109 0 croak "Can't understand $_";
110 }
111 }
112 }
113
114 # On older perls, code attribute handlers run before the sub gets placed
115 # in its package. Since the :ATTR handlers need to know the name of the
116 # sub they're applied to, the name lookup (via findsym) needs to be
117 # delayed: we do it immediately before we might need to find attribute
118 # handlers from their name. However, on newer perls (which fix some
119 # problems relating to attribute application), a sub gets placed in its
120 # package before its attributes are processed. In this case, the
121 # delayed name lookup might be too late, because the sub we're looking
122 # for might have already been replaced. So we need to detect which way
123 # round this perl does things, and time the name lookup accordingly.
124 4 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
125 4 my $delayed;
126 sub Attribute::Handlers::Clean::_TEST_::MODIFY_CODE_ATTRIBUTES {
127 $delayed = \&Attribute::Handlers::Clean::_TEST_::t != $_[1];
128 return ();
129 }
130 4 ▶ sub Attribute::Handlers::Clean::_TEST_::t :T { }
Subroutine BEGIN: called CC=1 SCAR=0.0
131 4 ▶ *_delayed_name_resolution = sub() { $delayed };
Subroutine __ANON__: called CC=1 SCAR=0.0
132 4 undef &Attribute::Handlers::Clean::_TEST_::MODIFY_CODE_ATTRIBUTES;
133 4 undef &Attribute::Handlers::Clean::_TEST_::t;
134 }
135
136 22 ▶sub _resolve_lastattr {
Subroutine _resolve_lastattr: called CC=6 SCAR=18.1
137 22 ▶ return unless $lastattr{ref};
Branch: 1 branch
BranchTrueFalseTotal
unless $lastattr{"ref"} 1 21 22
138 22 ▶ my $sym = findsym @lastattr{'pkg','ref'} or die "Internal error: $lastattr{pkg} symbol went missing";
Branch: 1 branch
BranchTrueFalseTotal
my $sym = findsym(@lastattr{"pkg", "ref"}) or die qq[Internal error: $lastattr{"pkg"} symbol went missing] 22 0 22
139 22 my $name = *{$sym}{NAME};
140 22 ▶ warn "Declaration of $name attribute in package $lastattr{pkg} may clash with future reserved word\n" if $^W and $name !~ /[A-Z]/;
Branch: 1 branch
BranchTrueFalseTotal
if $^W and not $name =~ /[A-Z]/ 0 21 21
Condition66%2/3
$^W and not $name =~ /[A-Z]/
!ll&&!rl&&r
2110
MC/DC0%0/2
$^W and not $name =~ /[A-Z]/
$^W not $name =~ /[A-Z]/
Truth table66%2/3
A and not(B)
A= $^WB= not $name =~ /[A-Z]/
ABresult
0X0
100
111
141 22 foreach ( @{$validtype{$lastattr{type}}} ) {
142 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
143 48 *{"$lastattr{pkg}::_ATTR_${_}_${name}"} = $lastattr{ref};
144 }
145 22 %lastattr = ();
146 }
147
148 1 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=3 SCAR=12.5
149 1 ▶ return if $AUTOLOAD =~ /::DESTROY$/;
Branch: 1 branch
BranchTrueFalseTotal
if $Attribute::Handlers::Clean::AUTOLOAD =~ /::DESTROY$/ 0 0 0
150 1 my ($class) = $AUTOLOAD =~ m/(.*)::/g;
151 1 ▶ $AUTOLOAD =~ m/_ATTR_(.*?)_(.*)/ or croak "Can't locate class method '$AUTOLOAD' via package '$class'";
Branch: 1 branch
BranchTrueFalseTotal
$Attribute::Handlers::Clean::AUTOLOAD =~ /_ATTR_(.*?)_(.*)/ or croak("Can't locate class method '$Attribute::Handlers::Clean::AUTOLOAD' via package '${class}'") 0 1 1
152 1 croak "Attribute handler '$2' doesn't handle $1 attributes";
153 }
154
155 4 my $builtin = qr/lvalue|locked|unique|shared/; # Method left out on purpose.
156
157
158 20 ▶sub _gen_handler_AH_() {
Subroutine _gen_handler_AH_: called CC=1 SCAR=0.0
159 74 ▶ sub {
Subroutine __ANON__: called CC=20 SCAR=30.2
160 74 ▶ _resolve_lastattr if _delayed_name_resolution;
Branch: 1 branch
BranchTrueFalseTotal
if &_delayed_name_resolution() 0 75 75
161 74 my ($pkg, $ref, @attrs) = @_;
162 74 push @attrs, attributes::get($ref);
163 74 Perlmazing::remove_duplicates(@attrs);
164 74 my (undef, $filename, $linenum) = caller 2;
165 74 foreach (@attrs) {
166 75 ▶ my ($attr, $data) = /^([a-z_]\w*)(?:[(](.*)[)])?$/is or next;
Branch: 1 branch
BranchTrueFalseTotal
() = /^([a-z_]\w*)(?:[(](.*)[)])?$/is or next 76 0 76
167 75 ▶ if ($attr eq 'ATTR') {
Branch: 1 branch
BranchTrueFalseTotal
if ($attr eq 'ATTR') { } 21 54 75
168 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
169 21 ▶ $data ||= "ANY";
Condition100%2/2
$data ||= "ANY"
l!l
192
MC/DC100%1/1
$data ||= "ANY"
$data
Truth table100%2/2
A
A= $data
Aresult
11
00
170 21 $raw{$ref} = $data =~ s/\s*,?\s*RAWDATA\s*,?\s*//;
171 21 ▶ $phase{$ref}{BEGIN} = 1 if $data =~ s/\s*,?\s*(BEGIN)\s*,?\s*//;
Branch: 1 branch
BranchTrueFalseTotal
if $data =~ s/\s*,?\s*(BEGIN)\s*,?\s*// 2 20 22
172 21 ▶ $phase{$ref}{INIT} = 1 if $data =~ s/\s*,?\s*(INIT)\s*,?\s*//;
Branch: 1 branch
BranchTrueFalseTotal
if $data =~ s/\s*,?\s*(INIT)\s*,?\s*// 1 21 22
173 21 ▶ $phase{$ref}{END} = 1 if $data =~ s/\s*,?\s*(END)\s*,?\s*//;
Branch: 1 branch
BranchTrueFalseTotal
if $data =~ s/\s*,?\s*(END)\s*,?\s*// 1 21 22
174 21 ▶ $phase{$ref}{CHECK} = 1 if $data =~ s/\s*,?\s*(CHECK)\s*,?\s*// || ! keys %{$phase{$ref}};
Branch: 1 branch
BranchTrueFalseTotal
if $data =~ s/\s*,?\s*(CHECK)\s*,?\s*// or not keys %{$phase{$ref};} 17 5 22
Condition100%3/3
$data =~ s/\s*,?\s*(CHECK)\s*,?\s*// or not keys %{$phase{$ref};}
l!l&&r!l&&!r
2155
MC/DC100%2/2
$data =~ s/\s*,?\s*(CHECK)\s*,?\s*// or not keys %{$phase{$ref};}
$data =~ s/\s*,?\s*(CHECK)\s*,?\s*// not keys %{$phase{$ref};}
Truth table100%3/3
A or not(B)
A= $data =~ s/\s*,?\s*(CHECK)\s*,?\s*//B= not keys %{$phase{$ref};}
ABresult
1X1
011
000
175 # Added for cleanup to not pollute next call.
176 21 ▶ (%lastattr = ()), croak "Can't have two ATTR specifiers on one subroutine" if keys %lastattr;
Branch: 1 branch
BranchTrueFalseTotal
if keys %lastattr 0 21 21
177 21 ▶ croak "Bad attribute type: ATTR($data)" unless $validtype{$data};
Branch: 1 branch
BranchTrueFalseTotal
unless $validtype{$data} 0 21 21
178 21 %lastattr=(pkg=>$pkg,ref=>$ref,type=>$data);
179 21 ▶ _resolve_lastattr unless _delayed_name_resolution;
Branch: 1 branch
BranchTrueFalseTotal
unless &_delayed_name_resolution() 21 0 21
180 } else {
181 54 my $type = ref $ref;
182 54 my $handler = $pkg->can("_ATTR_${type}_${attr}");
183 54 ▶ next unless $handler;
Branch: 1 branch
BranchTrueFalseTotal
unless $handler 0 54 54
184 54 my $decl = [$pkg, $ref, $attr, $data, $raw{$handler}, $phase{$handler}, $filename, $linenum];
185 54 foreach my $gphase (@global_phases) {
186 _apply_handler_AH_($decl,$gphase)
187 216 ▶ if $global_phases{$gphase} <= $global_phase;
Branch: 1 branch
BranchTrueFalseTotal
if $global_phases{$gphase} <= $global_phase 124 92 216
188 }
189 54 ▶ if ($global_phase != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($global_phase != 0) { } 35 19 54
190 # if _gen_handler_AH_ is being called after
191 # CHECK it's for a lexical, so make sure
192 # it didn't want to run anything later
193 35 local $Carp::CarpLevel = 2;
194 35 ▶ carp "Won't be able to apply END handler" if $phase{$handler}{END};
Branch: 1 branch
BranchTrueFalseTotal
if $phase{$handler}{"END"} 1 34 35
195 } else {
196 19 push @declarations, $decl
197 }
198 }
199 74 $_ = undef;
200 }
201 73 ▶ return grep {defined && !/$builtin/} @attrs;
Condition33%1/3
defined $_ && !/$builtin/
!ll&&!rl&&r
7400
MC/DC0%0/2
defined $_ && !/$builtin/
defined $_ !/$builtin/
Truth table33%1/3
A && not(B)
A= defined $_B= !/$builtin/
ABresult
0X0
100
111
202 }
203 20 }
204
205 181 ▶sub _apply_handler_AH_ {
Subroutine _apply_handler_AH_: called CC=10 SCAR=23.0
206 181 my ($declaration, $phase) = @_;
207 181 my ($pkg, $ref, $attr, $data, $raw, $handlerphase, $filename, $linenum) = @$declaration;
208 181 ▶ return unless $handlerphase->{$phase};
Branch: 1 branch
BranchTrueFalseTotal
unless $handlerphase->{$phase} 128 53 181
209 # print STDERR "Handling $attr on $ref in $phase with [$data]\n";
210 53 my $type = ref $ref;
211 53 my $handler = "_ATTR_${type}_${attr}";
212 53 my $sym = findsym($pkg, $ref);
213 53 ▶ $sym ||= $type eq 'CODE' ? 'ANON' : 'LEXICAL';
Branch: 1 branch
BranchTrueFalseTotal
$type eq 'CODE' ? : 0 34 34
Condition66%2/3
$sym ||= $type eq "CODE" ? "ANON" : "LEXICAL"
l!l&&r!l&&!r
20340
MC/DC0%0/2
$sym ||= $type eq "CODE" ? "ANON" : "LEXICAL"
$sym $type eq "CODE" ? "ANON" : "LEXICAL"
Truth table0%0/3
A ||= B
A= $symB= $type eq "CODE" ? "ANON" : "LEXICAL"
ABresult
1X1
011
000
214 4 ▶ no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
215 53 ▶ if (!$raw && defined($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $raw and defined $data) 45 8 53
Condition66%2/3
not $raw and defined $data
!ll&&!rl&&r
0845
MC/DC50%1/2
not $raw and defined $data
not $raw defined $data
Truth table66%2/3
not(A) and B
A= not $rawB= defined $data
ABresult
0X0
100
111
216 45 ▶ if ($data ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($data ne '') { } 45 0 45
217 45 ▶ my $evaled = eval(
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
218 "
219 package $pkg;
220 no warnings;
221 no strict;
222 local \$SIG{__WARN__}=sub{die};
223 [$data]
224 "
225 );
226 45 ▶ $data = $evaled unless $@;
Branch: 1 branch
BranchTrueFalseTotal
unless $@ 43 2 45
227 } else {
228 0 $data = undef;
229 }
230 }
231 $pkg->$handler(
232 $sym,
233 53 ▶ (ref $sym eq 'GLOB' ? *{$sym}{ref $ref} || $ref : $ref),
Branch: 1 branch
BranchTrueFalseTotal
ref $sym eq 'GLOB' ? : 19 34 53
Condition33%1/3
*{$sym;}{ref $ref} or $ref
l!l&&r!l&&!r
1900
MC/DC0%0/2
*{$sym;}{ref $ref} or $ref
*{$sym;}{ref $ref} $ref
Truth table33%1/3
A or B
A= *{$sym;}{ref $ref}B= $ref
ABresult
1X1
011
000
234 $attr,
235 $data,
236 $phase,
237 $filename,
238 $linenum,
239 );
240 53 return 1;
241 }
242
243 {
244 4 ▶ no warnings 'void';
Subroutine BEGIN: called CC=1 SCAR=0.0
245 4 ▶ CHECK {
Subroutine CHECK: called CC=3 SCAR=11.1
246 4 $global_phase++;
247 4 ▶ _resolve_lastattr if _delayed_name_resolution;
Branch: 1 branch
BranchTrueFalseTotal
if &_delayed_name_resolution() 0 4 4
248 4 foreach my $decl (@declarations) {
249 19 _apply_handler_AH_($decl, 'CHECK');
250 }
251 }
252 4 ▶ INIT {
Subroutine INIT: called CC=2 SCAR=6.9
253 4 $global_phase++;
254 4 foreach my $decl (@declarations) {
255 19 _apply_handler_AH_($decl, 'INIT');
256 }
257 }
258 }
259
260 4 ▶END {
Subroutine END: called CC=2 SCAR=6.9
261 4 $global_phase++;
262 4 foreach my $decl (@declarations) {
263 19 _apply_handler_AH_($decl, 'END');
264 }
265 }
266
267 4 1;
268
269 __END__
↑ Summary