MyXML/Util.pm

filter: Statementstmt 88.0% 22 / 25 Branchbran 50.0% 4 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 3 totaltotal 71.7% 33 / 46 CC 6 SCAR 12.3
CC
6
Cov
78%
debug
6.0
strip_ns
4.1
trim
2.0
CRAP 3.4
« MyXML/Object.pm ↑ Summary
1 package XML::MyXML::Util;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 require Exporter;
7 6 our @ISA = ('Exporter');
8 6 our @EXPORT_OK = qw/ trim strip_ns debug /;
9  
10 6 our $VERSION = "1.11";
11  
12 2 ▶sub trim {
Subroutine trim: called CC=2 SCAR=7.0
Pod undocumented
13 2 my $string = shift;
14  
15 2 ▶ if (defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $string) 2 0 2
16 2 $string =~ s/^\s+//;
17 2 $string =~ s/\s+$//;
18 }
19  
20 2 return $string;
21 }
22  
23 3 ▶sub strip_ns {
Subroutine strip_ns: called CC=4 SCAR=14.0
Pod undocumented
24 3 my $string = shift;
25  
26 3 ▶ defined $string or return undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $string or return undef 3 0 3
27  
28 3 my $num_colons = () = $string =~ /\:/g;
29 3 ▶ if ($num_colons == 1 and $string =~ /.\:./) {
Branch: 1 branch
BranchTrueFalseTotal
if ($num_colons == 1 and $string =~ /.\:./) 2 1 3
Condition66%2/3
$num_colons == 1 and $string =~ /.\:./
!ll&&!rl&&r
102
MC/DC50%1/2
$num_colons == 1 and $string =~ /.\:./
$num_colons == 1 $string =~ /.\:./
Truth table66%2/3
A and B
A= $num_colons == 1B= $string =~ /.\:./
ABresult
0X0
100
111
30 2 $string =~ s/^.+\://;
31 }
32  
33 3 return $string;
34 }
35  
36 0 ▶sub debug {
Subroutine debug: not called CC=2 SCAR=17.9
Pod undocumented
37 0 my $thing = shift;
38 0 require Data::Dumper;
39 0 ▶ warn Data::Dumper::Dumper($thing) if $ENV{DEBUG};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"DEBUG"} 0 0 0
40 }
41  
42 6 1;
« MyXML/Object.pm ↑ Summary