| 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
| |||||||||||||||
| 13 | |||||||||||||||
| 14 | 19 | $self->{DEBUGLEVEL} = 0; | |||||||||||||
| 15 | 19 | ▶ | $self->{DEBUGLEVEL} = $args{debuglevel} if exists($args{debuglevel}); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 16 | |||||||||||||||
| 17 | 19 | $self->{DEBUGFILE} = ""; | |||||||||||||
| 18 | |||||||||||||||
| 19 | 19 | ▶ | $args{debugfh} ||= ''; | ||||||||||||
|
Condition50%1/2
$args{"debugfh"} ||= ""
MC/DC0%0/1
$args{"debugfh"} ||= ""
$args{"debugfh"}
Truth table50%1/2
A
A= $args{"debugfh"}
| |||||||||||||||
| 20 | 19 | ▶ | $args{debug} ||= ''; | ||||||||||||
|
Condition100%2/2
$args{"debug"} ||= ""
MC/DC100%1/1
$args{"debug"} ||= ""
$args{"debug"}
Truth table100%2/2
A
A= $args{"debug"}
| |||||||||||||||
| 21 | |||||||||||||||
| 22 | 19 | ▶ | if ($args{debugfh} ne "") | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 38 | { | ||||||||||||||
| 39 | 0 | ▶ | if (-w $args{debug}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 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
| |||||||||||||||
| 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 | |||||||||||||||