Branch Coverage

blib/lib/Sys/Syslog.pm
Criterion Covered Total %
branch 104 220 47.2


line true false branch
84 5 0 defined &Socket::IPPROTO_TCP ? :
85 5 0 defined &Socket::IPPROTO_UDP ? :
86 5 0 defined &Socket::TCP_NODELAY ? :
193 0 3 if $constname eq 'constant'
195 3 0 if $error
211 3 0 if exists $options{$opt}
214 0 7 delete $options{'nofatal'} ? :
215 3 4 unless $options{'ndelay'}
220 1 0 if $connected
229 6 5 unless $_[0] == 0
313 1 17 unless @_ >= 1 and @_ <= 3
316 10 7 if (my $ref = ref $_[0]) { }
317 1 9 if ($ref eq 'HASH') { }
8 1 elsif ($ref eq 'ARRAY') { }
319 1 0 unless keys %opt
335 1 14 unless defined $opt{'type'}
336 8 6 ref $opt{'type'} eq 'ARRAY' ? :
341 0 14 unless exists $mechanism{$sock_type}
342 2 12 if $sock_type eq 'inet'
349 2 12 if defined $opt{'path'}
350 0 14 if defined $opt{'host'}
351 0 14 if defined $opt{'timeout'}
352 0 14 if defined $opt{'port'}
354 0 14 if $connected
362 7 9 if ($mechanism{$sock_type}{'check'}->()) { }
373 7 7 unless @connectMethods
388 1 8 unless $ident
392 2 7 unless defined $priority
393 1 6 unless defined $mask
395 1 5 if ($priority =~ /^\d+$/) { }
4 1 elsif ($priority =~ /^\w+/) { }
398 1 0 if $numfac == 0
408 0 6 if length $word == 0
413 1 5 if ($num < 0) { }
3 2 elsif ($num <= &LOG_PRIMASK() and $word ne 'kern') { }
417 1 2 if defined $numpri
422 1 1 if defined $numfac
424 1 0 if $word =~ /^[A-Za-z]/
433 0 2 unless defined $numpri
436 0 2 unless LOG_MASK($numpri) & $maskpri
438 2 0 unless (defined $numfac)
439 0 2 unless $Sys::Syslog::facility
443 0 2 unless $connected
445 1 1 if ($mask =~ /%m/)
447 0 1 if @args
453 2 0 if not $options{'noeol'} and rindex($mask, "\n") == -1
454 0 2 @args ? :
456 2 0 if ($current_proto eq 'native') { }
0 0 elsif ($current_proto eq 'eventlog') { }
464 0 0 if $options{'pid'}
477 0 0 if (index($day, '%') == 0)
489 0 0 unless $options{'nonul'}
494 0 2 if ($options{'perror'} and $current_proto ne 'native')
496 0 0 if $options{'pid'}
498 0 0 if rindex($message, "\n") == -1
507 0 2 if ($failed and time - $fail_time > 60)
515 0 2 if ($connected and not connection_ok())
518 0 0 unless $failed
523 0 2 unless $connected
524 0 2 if $current_proto and $failed and $current_proto eq $failed
526 2 0 if ($syslog_send)
527 2 0 if (&$syslog_send($buf, $numpri, $numfac))
546 0 0 if (my $pid = fork) { }
548 0 0 if ($options{'nowait'}) { }
551 0 0 if (waitpid($pid, 0) >= 0) { }
560 0 0 if (open CONS, '>/dev/console')
562 0 0 if defined $pid
566 0 0 if defined $pid
604 0 10 if $name =~ /^\s*\d+\s*$/
606 10 0 unless $name =~ /^LOG_/
616 10 0 if (index($value, 'not a valid') >= 0)
619 1 9 unless defined $value
622 1 9 if index($value, 'not a valid') >= 0
624 10 0 defined $value ? :
635 4 0 unless scalar @fallbackMethods
637 0 4 if ($transmit_ok and $current_proto)
649 4 0 if defined &$fn
650 1 3 if $connected
654 1 3 if ($connected) { }
670 0 0 unless (defined $port)
676 0 0 if (defined $Sys::Syslog::host) { }
678 0 0 unless ($addr)
687 0 0 unless (socket SYSLOG, 2, 1, 6)
695 0 0 unless (connect SYSLOG, $addr)
710 0 2 unless (defined $port)
716 0 2 if (defined $Sys::Syslog::host) { }
718 0 0 unless ($addr)
727 0 2 unless (socket SYSLOG, 2, 2, 17)
731 0 2 unless (connect SYSLOG, $addr)
739 2 0 unless (connection_ok())
753 0 1 unless defined $syslog_path
755 1 0 unless (-w $syslog_path)
762 0 0 unless (sysopen SYSLOG, $syslog_path, 1, 256)
777 0 0 unless (-w $syslog_path)
782 0 0 unless (open SYSLOG, ">$syslog_path")
795 0 0 if length &_PATH_LOG()
797 0 0 unless (defined $syslog_path)
802 0 0 unless (-S $syslog_path or -c _)
808 0 0 unless ($addr)
812 0 0 unless (socket SYSLOG, 1, 1, 0)
817 0 0 unless (connect SYSLOG, $addr)
818 0 0 unless (socket SYSLOG, 1, 2, 0)
822 0 0 unless (connect SYSLOG, $addr)
839 1 5 if $options{$opt}
859 0 0 unless (-w '/dev/console')
874 0 0 if defined $current_proto and $current_proto eq 'native' || $current_proto eq 'console' || $current_proto eq 'eventlog'
882 2 0 $ret ? :
889 1 0 if (defined $current_proto and $current_proto eq 'native') { }
0 0 elsif (defined $current_proto and $current_proto eq 'eventlog') { }
922 0 6 if not $loaded and $verbose