Branch Coverage

lib/Nagios/StatusLog.pm
Criterion Covered Total %
branch 63 142 44.3


line true false branch
105 432 4 unless $method eq 'status'
157 1 2 if @_ == 1
160 2 1 if (@_ % 2 == 0)
163 2 2 if (lc $param eq 'filename') { }
2 0 elsif (lc $param eq 'version') { }
172 0 3 unless (defined $logfile and -r $logfile)
205 1 3 if ($$self{'VERSION'} >= 3)
208 1 2 if ($$self{'VERSION'} == 2)
229 0 2 unless open $log_fh, "<$$self{'LOGFILE'}"
237 2 30 unless defined $LOG[$i] and length $LOG[$i]
245 24 6 if ($type eq 'SERVICE') { }
4 2 elsif ($type eq 'HOST') { }
2 0 elsif ($type eq 'PROGRAM') { }
252 12 12 if (not exists $$self{$type}{$$ldata{'host_name'}}{$$ldata{'description'}}) { }
271 2 2 if (not exists $$self{$type}{$$ldata{'host_name'}}) { }
281 0 2 if (not defined $$self{$type}) { }
291 16 14 if (defined $ref)
314 1 0 unless (exists $$self{'HOST'}{$host})
324 11 0 unless (exists $$self{'SERVICE'}{$host}{$svc})
339 0 1 unless open $log_fh, "<$$self{'LOGFILE'}"
378 1 0 unless (exists $$self{'HOST'}{$host})
388 1 0 unless (exists $$self{'SERVICE'}{$host}{$svc})
396 2 0 unless (exists $$self{'CONTACT'}{$contact})
415 0 0 unless (exists $$self{'SERVICECOMMENT'}{$host}{$svc}{$id})
425 0 0 unless (exists $$self{'HOSTCOMMENT'}{$host}{$id})
436 0 0 unless (exists $$self{'SERVICEDOWNTIME'}{$host}{$svc}{$id})
446 0 0 unless (exists $$self{'HOSTDOWNTIME'}{$host}{$id})
455 0 1 unless open $log_fh, "<$$self{'LOGFILE'}"
464 13 185 if $line =~ /^\s*#|^\s*$/
465 173 12 if ($line =~ /\s*(\w+)=(.*)$/) { }
6 6 elsif ($line =~ /^\s*(\w+)\s*{\s*$/) { }
6 0 elsif ($line =~ /^\s*}\s*$/) { }
470 6 0 if (exists $valid_types{$1}) { }
479 6 0 if ($type)
491 0 30 ref $_[0] ? :
493 0 30 wantarray ? :
540 0 5 if (ref $host eq 'Nagios::Host')
545 0 5 if (ref $host eq 'Nagios::Service')
549 0 5 if (ref $service eq 'Nagios::Service')
553 0 5 unless $$self{'SERVICE'}{$host}
555 0 5 unless $$self{'SERVICE'}{$host}{$service}
594 0 0 if (ref $host and UNIVERSAL::can($host, 'host_name'))
617 0 0 unless $$self{'SERVICE'}{$host}{$service}{'current_state'} == 0
658 0 3 if (ref($host) =~ /^Nagios::(Host|Service)$/)
662 0 3 unless $$self{'HOST'}{$host}
731 0 2 if ref $name eq 'Nagios::Contact'
733 0 2 unless $$self{'CONTACT'}{$name}
767 0 0 if ref($host) =~ /^Nagios::(Host|Service)$/
769 0 0 unless $$self{'HOSTCOMMENT'}{$host}
808 0 0 if ref $host eq 'Nagios::Host'
811 0 0 if (ref $host eq 'Nagios::Service')
815 0 0 if ref $service eq 'Nagios::Service'
819 0 0 unless $host and $service and $$self{'SERVICECOMMENT'}{$host}{$service}
859 0 0 if ref($host) =~ /^Nagios::(Host|Service)$/
861 0 0 unless $$self{'HOSTDOWNTIME'}{$host}
903 0 0 if ref $host eq 'Nagios::Host'
906 0 0 if (ref $host eq 'Nagios::Service')
910 0 0 if ref $service eq 'Nagios::Service'
913 0 0 unless $$self{'SERVICEDOWNTIME'}{$host}{$service}
951 0 0 unless open $fh, ">$filename"
1010 2 0 if ($$self{'__parent'}{'VERSION'} > 1.9999999) { }
1011 2 0 if ($$self{'current_state'} == 0) { }
0 0 elsif ($$self{'current_state'} == 1) { }
0 0 elsif ($$self{'current_state'} == 2) { }
0 0 elsif ($$self{'current_state'} == 3) { }
1012 1 1 if ($$self{'has_been_checked'} == 0) { }
1043 1 0 if ($$self{'__parent'}{'VERSION'} > 1.9999999) { }
1044 1 0 if ($$self{'current_state'} == 0) { }
0 0 elsif ($$self{'current_state'} == 1) { }
0 0 elsif ($$self{'current_state'} == 2) { }
1045 0 1 if ($$self{'has_been_checked'} == 0) { }