blib/lib/XML/Stream/Tools.pm

filter: Statementstmt 58.9% 23 / 39 Branchbran 50.0% 8 / 16 Conditioncond 75.0% 3 / 4 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 59.0% 39 / 66 CC 11 SCAR 30.7
CC
11
Cov
58%
setup_debug
27.1
BEGIN
1.0
BEGIN
1.0
CRAP 21.5
« blib/lib/XML/Stream/Parser/DTD.pm ↑ Summary blib/lib/XML/Stream/Parser.pm »
1 package XML::Stream::Tools;
2 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 12 ▶use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # helper function (not a method!)
8 sub setup_debug {
9 19 ▶ my ($self, %args) = @_;
Subroutine setup_debug: called CC=11 SCAR=33.0
Pod undocumented
10  
11 19 $self->{DEBUGTIME} = 0;
12 19 ▶ $self->{DEBUGTIME} = $args{debugtime} if exists($args{debugtime});
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"debugtime"} 1 18 19
13  
14 19 $self->{DEBUGLEVEL} = 0;
15 19 ▶ $self->{DEBUGLEVEL} = $args{debuglevel} if exists($args{debuglevel});
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"debuglevel"} 2 17 19
16  
17 19 $self->{DEBUGFILE} = "";
18  
19 19 ▶ $args{debugfh} ||= '';
Condition50%1/2
$args{"debugfh"} ||= ""
l!l
019
MC/DC0%0/1
$args{"debugfh"} ||= ""
$args{"debugfh"}
Truth table50%1/2
A
A= $args{"debugfh"}
Aresult
11
00
20 19 ▶ $args{debug} ||= '';
Condition100%2/2
$args{"debug"} ||= ""
l!l
118
MC/DC100%1/1
$args{"debug"} ||= ""
$args{"debug"}
Truth table100%2/2
A
A= $args{"debug"}
Aresult
11
00
21  
22 19 ▶ if ($args{debugfh} ne "")
Branch: 2 branches
BranchTrueFalseTotal
if ($args{'debugfh'} ne '') { } 0 19 19
elsif ($args{'debug'} ne '') { } 1 18 19
23 {
24 0 $self->{DEBUGFILE} = $args{debugfh};
25 0 $self->{DEBUG} = 1;
26 }
27 elsif ($args{debug} ne "")
28 {
29 1 $self->{DEBUG} = 1;
30 1 ▶ if (lc($args{debug}) eq "stdout")
Branch: 1 branch
BranchTrueFalseTotal
if (lc $args{'debug'} eq 'stdout') { } 1 0 1
31 {
32 1 $self->{DEBUGFILE} = FileHandle->new(">&STDERR");
33 1 $self->{DEBUGFILE}->autoflush(1);
34 }
35 else
36 {
37 0 ▶ if (-e $args{debug})
Branch: 1 branch
BranchTrueFalseTotal
if (-e $args{'debug'}) { } 0 0 0
38 {
39 0 ▶ if (-w $args{debug})
Branch: 1 branch
BranchTrueFalseTotal
if (-w $args{'debug'}) { } 0 0 0
40 {
41 0 $self->{DEBUGFILE} = FileHandle->new(">$args{debug}");
42 0 $self->{DEBUGFILE}->autoflush(1);
43 }
44 else
45 {
46 0 print "WARNING: debug file ($args{debug}) is not writable by you\n";
47 0 print " No debug information being saved.\n";
48 0 $self->{DEBUG} = 0;
49 }
50 }
51 else
52 {
53 0 $self->{DEBUGFILE} = FileHandle->new(">$args{debug}");
54 0 ▶ if (defined($self->{DEBUGFILE}))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'DEBUGFILE'}) { } 0 0 0
55 {
56 0 $self->{DEBUGFILE}->autoflush(1);
57 }
58 else
59 {
60 0 print "WARNING: debug file ($args{debug}) does not exist \n";
61 0 print " and is not writable by you.\n";
62 0 print " No debug information being saved.\n";
63 0 $self->{DEBUG} = 0;
64 }
65 }
66 }
67 }
68 }
69  
70  
71  
72  
73 12 1;
74  
75  
« blib/lib/XML/Stream/Parser/DTD.pm ↑ Summary blib/lib/XML/Stream/Parser.pm »