Branch Coverage

blib/lib/Schedule/Cron.pm
Criterion Covered Total %
branch 200 346 57.8


line true false branch
80 0 17 $@ ? :
144 0 0 if ($HAS_POSIX) { }
147 0 0 if ($STARTEDCHILD{$pid})
148 0 0 $HAS_POSIX ? :
149 0 0 if ($res > 0)
152 0 0 if $DEBUG
181 6 0 $HAS_POSIX ? :
182 0 6 if $DEBUG
183 1 0 if ($kid != 0 and $kid != -1 and defined $STARTEDCHILD{$kid})
188 0 1 if $DEBUG
213 4 10 if $HAS_POSIX and not $cfg->{'nofork'}
220 0 5 unless $STARTEDCHILD{$k}
376 0 27 unless ref $dispatcher eq "CODE"
377 6 21 ref $_[0] eq 'HASH' ? :
378 24 3 unless $cfg->{'processprefix'}
389 1 26 if $cfg->{'file'}
435 4 1 if ($cfg)
437 1 3 if (@_) { }
2 1 elsif (not ref $cfg) { }
439 0 1 ref $cfg eq 'HASH' ? :
452 0 5 unless open F, $file
460 160 185 if /^\s*$/
461 0 185 if /^\s*#/
471 185 0 if ($rest)
474 15 170 if ($col6 =~ m[^[\d\-\*\,/]+$]) { }
624 193 26 if (ref $args eq 'HASH') { }
4 22 elsif (ref $args eq 'CODE') { }
630 112 81 if ($cfg->{'eval'} and $cfg)
632 1 111 if ref $args
634 0 111 if $DEBUG
636 0 111 if $@
645 81 137 if (ref $args ne "ARRAY")
653 185 33 ref $time ? :
654 1 217 if $#$time_array != 4 and $#$time_array != 5
671 193 24 if $id
731 91 1 if ($entry) { }
752 3 0 if ($idx <= $#{$$self{'time_table'};}) { }
762 2 4 if ($map->{$key} > $idx) { }
2 2 elsif ($map->{$key} == $idx) { }
789 0 1 unless $entry
790 0 1 unless $entry->{'time'}
792 1 0 if ($idx <= $#{$$self{'time_table'};}) { }
796 1 0 unless $new_entry->{'dispatcher'}
798 0 1 unless $new_entry->{'args'}
860 1 17 ref $_[0] eq 'HASH' ? :
865 18 0 unless defined $loglevel
870 0 18 unless @{$self->{'queue'};}
873 5 13 unless ($cfg->{'nofork'})
876 0 1 if $DEBUG
878 1 0 if ($old_child_handler and ref $old_child_handler eq "CODE")
880 0 1 if $DEBUG
889 2 16 if (my $name = $cfg->{'processname'})
897 0 32 unless (@{$self->{'queue'};})
904 0 32 if $DEBUG
907 1 31 if ($time < $now) { }
909 1 0 if ($cfg->{'skip'})
912 1 0 if $log and $loglevel <= 0
926 27 2 unless ($cfg->{'processname'} or $cfg->{'nostatus'})
930 0 31 unless ($time)
931 0 0 unless $time
934 0 31 if $DEBUG
938 0 31 if ($sleeper) { }
941 0 0 if ($self->{'entries_changed'})
957 1 20 if $cfg->{'skip'} and $time < $self->_now
961 3 11 if ($self->{'entries_changed'}) { }
962 0 3 if $DEBUG
973 0 18 if ($cfg->{'detach'}) { }
975 0 0 unless defined(my $pid = fork)
976 0 0 if ($pid) { }
979 0 0 if ($cfg->{'pid_file'})
981 0 0 if (open P, '>' . $cfg->{'pid_file'}) { }
999 0 0 unless open STDIN, "/dev/null"
1000 0 0 unless open STDOUT, ">/dev/null"
1003 0 0 if ($@) { }
1006 0 0 if (open T, "/dev/tty")
1010 0 0 if ($@)
1013 0 0 if ($@)
1019 0 0 if $@ or not $notty
1020 0 0 unless ioctl T, $notty, 0
1026 0 0 unless &POSIX::setsid()
1028 0 0 unless open STDERR, ">&STDOUT"
1030 0 0 unless ($cfg->{'processname'} or $cfg->{'nostatus'})
1124 50 52 unless ref $cron_entry
1128 0 102 if $#$cron_entry != 4 and $#$cron_entry != 5
1144 34 1358 if ($t =~ m[^([^-]+)-([^-/]+)(/(.*))?$]) { }
1147 10 24 unless $step
1148 7 27 unless ($low =~ /^(\d+)/)
1152 7 27 unless ($high =~ /^(\d+)/)
1156 0 34 if (not defined $low && defined $high or $low > $high or not $step =~ /^\d+$/)
1168 11 1347 unless $t =~ /^(\d+|\*)$/
1169 2 1356 if defined $t and exists $LOWMAP[$i]{$t}
1171 0 949 if not defined $t or $t ne "*" and $t < $RANGES[$i][0] || $t > $RANGES[$i][1]
1176 409 150 $#res == 0 && $res[0] eq '*' ? :
1186 4 97 if ($expanded[2][0] ne '*' and $expanded[4][0] ne '*') { }
1195 0 4 if $DEBUG
1196 3 1 $t1 < $t2 ? :
1288 7 29 unless ($cfg->{'nofork'})
1290 4 3 if ($pid = fork)
1293 0 4 if $log and $loglevel <= 0
1302 0 32 unless ref $dispatch eq "CODE"
1307 3 29 if (defined $args and defined $args->[0])
1313 7 25 if ($log and $loglevel <= 0 or not $cfg->{'nofork'} || $cfg->{'processname'} || $cfg->{'nostatus'})
1314 0 7 @args && $loglevel <= -1 ? :
1316 3 0 unless $cfg->{'nofork'} or $cfg->{'processname'} or $cfg->{'nostatus'}
1317 4 3 if $log and $loglevel <= 0
1321 2 30 if ($cfg->{'catch'}) { }
1328 2 0 if ($@)
1330 2 0 if $log and $loglevel <= 2
1340 1 19 if ($cfg->{'after_job'})
1342 1 0 if (ref $job eq 'CODE') { }
1347 0 1 if ($@)
1349 0 0 if $log and $loglevel <= 2
1353 0 0 if $log and $loglevel <= 2
1358 3 17 if $log and $loglevel <= 0
1359 3 17 unless $cfg->{'nofork'}
1373 0 48 if ($new_time <= $now)
1374 0 0 if $DEBUG
1381 0 48 if $DEBUG
1402 54 51 $expanded->[5] ? :
1421 0 131 if $DEBUG
1424 21 110 if ($expanded->[3][0] ne "*")
1426 8 13 unless (defined($dest_mon = $self->_get_nearest($dest_mon, $expanded->[3])))
1434 28 103 if ($expanded->[2][0] ne '*') { }
1436 12 16 if ($dest_mon != $now_mon) { }
1442 5 11 unless (defined($dest_mday = $self->_get_nearest($dest_mday, $expanded->[2])))
1447 5 0 if ($dest_mon > 12)
1452 0 5 if $DEBUG
1459 98 5 $dest_mon == $now_mon ? :
1463 17 109 if ($expanded->[4][0] ne '*') { }
1466 7 10 unless $dest_wday
1470 3 14 if $dest_mon != $now_mon
1477 0 17 if $DEBUG
1478 3 14 if ($mon != $dest_mon or $year != $dest_year)
1479 0 3 if $DEBUG
1492 0 109 unless ($dest_mday)
1494 0 0 $dest_mon == $now_mon ? :
1500 46 77 if ($expanded->[1][0] ne '*') { }
1502 27 19 if ($dest_mday != $now_mday or $dest_mon != $now_mon or $dest_year != $now_year) { }
1509 8 11 unless (defined($dest_hour = $self->_get_nearest($dest_hour, $expanded->[1])))
1525 74 3 $dest_mday == $now_mday ? :
1528 40 75 if ($expanded->[0][0] ne '*') { }
1530 30 10 if ($dest_hour != $now_hour or $dest_mday != $now_mday or $dest_mon != $dest_mon or $dest_year != $now_year) { }
1536 2 8 unless (defined($dest_min = $self->_get_nearest($dest_min, $expanded->[0])))
1552 1 66 if ($dest_hour != $now_hour or $dest_mday != $now_mday or $dest_year != $now_year)
1559 61 52 if ($expanded->[5]) { }
1561 45 16 if ($expanded->[5][0] ne '*') { }
1563 7 38 if ($dest_min != $now_min) { }
1569 7 31 unless (defined($dest_sec = $self->_get_nearest($dest_sec, $expanded->[5])))
1586 16 0 $dest_min == $now_min ? :
1597 0 106 if $DEBUG
1600 105 1 if ($result) { }
1635 84 398 if ($to_check->[$i] >= $x)
1669 0 15 if ($DEBUG)
1675 0 0 if (length $caller > 22)
1701 0 0 if ($inp)
1703 0 0 unless parsedate($inp)
1716 0 0 if (@entries != 5)
1728 0 0 if ($@)
1731 0 0 if ($@ eq 'TIMEOUT') { }
1741 0 0 if ($next_time > 0) { }
1755 0 0 unless ($expected_time = parsedate($inp))
1765 0 0 if ($expected eq $next) { }
1776 0 0 unless defined $email
1778 0 0 unless defined $email
1788 0 0 if $email
1792 0 0 unless ($endless)
1817 0 0 unless (defined $input_initialized)
1821 0 0 $@ ? :
1822 0 0 if ($input_initialized)
1829 0 0 if ($input_initialized) { }
1840 0 0 if ($#prompt > 0)
1872 0 101 unless ref $entry eq "ARRAY"
1876 0 559 unless ref $entry->[$i] eq "ARRAY"