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

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 1 Podpod n/a totaltotal 0.0% 0 / 50 CC 15 SCAR 54.8
CC
15
Cov
0%
import
240.0
CRAP 240.0
« /usr/local/lib/perl5/5.44.0/x86_64-linux/Cwd.pm ↑ Summary /usr/local/lib/perl5/5.44.0/base.pm »
1 package vars;
2  
3 use 5.006;
4  
5 our $VERSION = '1.05';
6  
7 use warnings::register;
8 use strict qw(vars subs);
9  
10 sub import {
11 0 ▶ my $callpack = caller;
Subroutine import: not called CC=15 SCAR=54.8
12 0 my (undef, @imports) = @_;
13 0 my ($sym, $ch);
14 0 foreach (@imports) {
15 0 ▶ if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { } 0 0 0
16 0 ▶ if ($sym =~ /\W/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sym =~ /\W/) 0 0 0
17 # time for a more-detailed check-up
18 0 ▶ if ($sym =~ /^\w+[[{].*[]}]$/) {
Branch: 3 branches
BranchTrueFalseTotal
if ($sym =~ /^\w+[[{].*[]}]$/) { } 0 0 0
elsif (warnings::enabled() and length $sym == 1 and not $sym =~ tr/A-Za-z//) { } 0 0 0
elsif ($^H & strict::bits('vars')) { } 0 0 0
19 0 require Carp;
20 0 Carp::croak("Can't declare individual elements of hash or array");
21 ▶ } elsif (warnings::enabled() and length($sym) == 1 and $sym !~ tr/a-zA-Z//) {
Condition0%0/6
warnings::enabled() and length $sym == 1 and not $sym =~ tr/A-Za-z//
!ll&&!rl&&r
000
warnings::enabled() and length $sym == 1
!ll&&!rl&&r
000
MC/DC0%0/3
warnings::enabled() and length $sym == 1 and not $sym =~ tr/A-Za-z//
warnings::enabled() length $sym == 1 not $sym =~ tr/A-Za-z//
Truth table0%0/4
A and B and not(C)
A= warnings::enabled()B= length $sym == 1C= not $sym =~ tr/A-Za-z//
ABCresult
0XX0
10X0
1100
1111
22 0 warnings::warn("No need to declare built-in vars");
23 } elsif (($^H & strict::bits('vars'))) {
24 0 require Carp;
25 0 Carp::croak("'$_' is not a valid variable name under strict vars");
26 }
27 }
28 0 ▶ $sym = "${callpack}::$sym" unless $sym =~ /::/;
Branch: 1 branch
BranchTrueFalseTotal
unless $sym =~ /::/ 0 0 0
29 *$sym =
30 ( $ch eq "\$" ? \$$sym
31 : $ch eq "\@" ? \@$sym
32 : $ch eq "\%" ? \%$sym
33 : $ch eq "\*" ? \*$sym
34 : $ch eq "\&" ? \&$sym
35 0 ▶ : do {
Branch: 5 branches
BranchTrueFalseTotal
$ch eq '$' ? : 0 0 0
$ch eq '@' ? : 0 0 0
$ch eq '%' ? : 0 0 0
$ch eq '*' ? : 0 0 0
$ch eq '&' ? : 0 0 0
36 0 require Carp;
37 0 Carp::croak("'$_' is not a valid variable name");
38 });
39 } else {
40 0 require Carp;
41 0 Carp::croak("'$_' is not a valid variable name");
42 }
43 }
44 };
45  
46 1;
47 __END__
« /usr/local/lib/perl5/5.44.0/x86_64-linux/Cwd.pm ↑ Summary /usr/local/lib/perl5/5.44.0/base.pm »