Branch Coverage

blib/lib/Config/Crontab.pm
Criterion Covered Total %
branch 293 376 77.9


line true false branch
58 20 10 if exists $args{'-file'}
59 2 28 if exists $args{'-mode'}
60 1 29 if exists $args{'-squeeze'}
61 2 28 if exists $args{'-strict'}
62 3 27 if exists $args{'-system'}
63 0 30 if exists $args{'-owner'}
64 0 30 if exists $args{'-owner_re'}
67 20 10 if $self->file
76 3 32 if exists $args{'-file'}
77 0 35 if exists $args{'-mode'}
78 0 35 if exists $args{'-squeeze'}
79 0 35 if exists $args{'-strict'}
80 0 35 if exists $args{'-system'}
81 0 35 if exists $args{'-owner'}
82 0 35 if exists $args{'-owner_re'}
85 0 35 if ($self->system and not $self->file)
92 34 1 if ($self->file) { }
94 4 30 unless (open $fh, $self->file)
96 1 3 if ($self->strict)
105 0 1 if ($self->owner)
106 0 0 if ($^O eq 'SunOS') { }
114 0 1 unless (open $fh, $crontab_cmd)
116 0 0 if ($self->strict)
131 2 29 if ($self->mode eq 'line') { }
2 27 elsif ($self->mode eq 'file') { }
142 26 1 $self->squeeze ? :
162 518 788 if (ref $blocks eq 'ARRAY')
183 0 4 unless (keys %crit)
190 4 0 if ($key eq 'index') { }
191 0 4 unless (defined $value)
192 0 0 if ($self->strict)
199 1 3 if (ref $value eq 'ARRAY') { }
3 0 elsif ($value =~ /^\d+$/) { }
209 0 0 if ($self->strict)
216 0 0 if ($self->strict)
226 0 35 unless my $obj = shift()
232 30 118 if ($line == $obj)
246 228 0 if (@objs)
248 0 238 unless defined $obj and ref $obj
250 14 224 unless (UNIVERSAL::isa($obj, 'Config::Crontab::Block'))
251 9 5 if ($self->block($obj)) { }
263 0 950 unless defined $block and ref $block
264 4 946 if ($block == $obj)
283 0 5 if (defined $file)
287 4 1 if ($self->file) { }
288 0 4 unless open my $ct, '>' . $self->file
304 0 1 if (my $owner = $self->owner) { }
313 0 1 if ($crontab or $?)
315 0 0 if ($self->strict)
331 0 2 if (defined $file)
335 1 1 if ($self->file) { }
341 0 1 if (my $owner = $self->owner) { }
350 0 1 if ($output or $?)
352 0 0 if ($self->strict)
368 158 45 if $ret and $block->dump
377 33 4 if (@_)
379 3 30 if ($owner)
380 1 2 unless (defined getpwnam $owner)
382 1 0 if ($self->strict)
388 1 1 if ($owner =~ $self->owner_re)
390 1 0 if ($self->strict)
398 35 0 defined $self->{'_owner'} ? :
403 30 2 if (@_)
407 32 0 defined $self->{'_owner_re'} ? :
1324 12 232 if defined $args{'-lines'}
1325 0 244 if defined $args{'-strict'}
1326 214 30 if defined $args{'-system'}
1329 221 23 if (defined $args{'-data'})
1334 244 0 defined $rv ? :
1342 226 417 if (defined $data)
1343 0 226 if (ref $data eq 'ARRAY') { }
210 16 elsif ($data) { }
16 0 elsif ($data eq '') { }
1361 217 266 if ($obj = 'Config::Crontab::Event'->new(-'data', $line, -'system', $self->system)) { }
60 206 elsif ($obj = 'Config::Crontab::Env'->new(-'data', $line)) { }
206 0 elsif ($obj = 'Config::Crontab::Comment'->new(-'data', $line)) { }
1372 0 0 if ($self->strict)
1384 762 632 if $ret
1387 603 40 if $ret
1399 1548 2639 if (ref $objs eq 'ARRAY')
1411 29 233 unless scalar keys %crit
1423 254 383 if ($key eq 'type') { }
1424 161 93 if ($value eq 'event') { }
27 66 elsif ($value eq 'env') { }
66 0 elsif ($value eq 'comment') { }
1425 68 93 unless UNIVERSAL::isa($line, 'Config::Crontab::Event')
1428 21 6 unless UNIVERSAL::isa($line, 'Config::Crontab::Env')
1431 38 28 unless UNIVERSAL::isa($line, 'Config::Crontab::Comment')
1434 0 0 if ($self->strict)
1444 239 144 if ($key =~ /^(.+)_re$/) { }
21 123 elsif ($key =~ /^(.+)_nre$/) { }
1445 202 37 unless $line->$1 =~ qr/$value/
1448 6 15 if $line->$1 =~ qr/$value/
1451 85 38 unless $line->$key eq $value
1466 543 6 if (@objs)
1468 0 557 unless defined $obj and ref $obj
1470 45 1103 unless defined $line and ref $line
1471 50 1053 if ($line == $obj)
1487 0 3 unless @_
1499 0 0 unless @_
1930 485 39 if defined $args{'-system'}
1931 47 477 unless ($args{'-data'})
1932 5 42 if defined $args{'-minute'}
1933 2 45 if defined $args{'-hour'}
1934 0 47 if defined $args{'-dom'}
1935 0 47 if defined $args{'-month'}
1936 0 47 if defined $args{'-dow'}
1938 0 47 if defined $args{'-user'}
1939 0 47 if defined $args{'-user'}
1941 2 45 if defined $args{'-special'}
1942 6 41 if defined $args{'-datetime'}
1943 11 36 if $args{'-command'}
1944 0 47 if defined $args{'-active'}
1945 0 47 if defined $args{'-nolog'}
1947 506 18 if defined $args{'-data'}
1949 256 268 defined $rv ? :
1957 510 730 if (@_)
1959 29 481 unless $data
1964 69 441 if ($self->system) { }
1965 43 26 if (@matches = $data =~ /^\s*(\#*)\s*(-?)(\@(?:reboot|midnight|(?:year|annual|month|week|dai|hour)ly))\s+(\S+)\s+(.+?)\s*$/ or @matches = $data =~ m[^\s*(\#*)\s*(-?)((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*|\w{3}(?:,\w{3})*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*|\w{3}(?:,\w{3})*))\s+(\S+)\s+(.+?)\s*$]) { }
1969 11 32 $active ? :
1970 1 42 $nolog ? :
1985 199 242 if (@matches = $data =~ /^\s*(\#*)\s*(-?)(\@(?:reboot|midnight|(?:year|annual|month|week|dai|hour)ly))\s+(.+?)\s*$/ or @matches = $data =~ m[^\s*(\#*)\s*(-?)((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*|\w{3}(?:,\w{3})*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*|\w{3}(?:,\w{3})*))\s+(.+?)\s*$]) { }
1989 73 126 $active ? :
1990 0 199 $nolog ? :
2004 8 105 $self->special ? :
113 0 $self->user ? :
113 858 $self->system ? :
971 1 $self->command ? :
2010 113 858 $self->system && $self->user ? :
971 1 $self->command ? :
2020 252 990 if ($data)
2022 245 7 if (ref $data eq 'ARRAY') { }
2026 29 216 if (scalar @matches == 1) { }
216 0 elsif (scalar @matches) { }
2054 3 4 if (@matches = $data =~ /(\@(?:reboot|midnight|(?:year|annual|month|week|dai|hour)ly))/) { }
4 0 elsif (@matches = $data =~ m[((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*|\w{3}(?:,\w{3})*))\s+((?:\*|(?:\d+|\*)(?:[-,\/]\d+)*(?:,(?:\d+|\*)(?:[-,\/]\d+)*)*|\w{3}(?:,\w{3})*))]) { }
2082 155 1087 if ($self->special)
2086 145 942 $self->system ? :
2096 771 370 if (@_)
2097 48 723 $_[0] ? :
2100 1141 0 defined $self->{'_user'} ? :
2107 443 234 $self->active ? :
2110 5 672 $self->nolog ? :
2604 2 283 if defined $args{'-active'}
2605 5 280 if $args{'-name'}
2606 5 280 if defined $args{'-value'}
2609 274 11 if (defined $args{'-data'})
2613 78 207 defined $rv ? :
2620 276 225 if (@_)
2622 29 247 unless $data
2625 69 207 if (@matches = $data =~ /^\s*(\#*)\s*(["']?[^=]+?['"]?)\s*=\s*(.*)$/) { }
2627 26 43 $active ? :
2638 288 6 $self->name ? :
2645 0 0 $self->active ? :
2652 201 6 if ($self->name)
2653 119 82 $self->active ? :
2845 2 226 @_ == 1 ? :
2848 223 5 if (exists $args{'-data'}) { }
0 5 elsif (@_) { }
2857 192 36 if $data
2861 227 1 defined $rv ? :
2868 229 645 if (@_)
2870 36 193 unless $data
2872 1 228 unless ($data =~ /^\s*$/ or $data =~ /^\s*\#/)
2879 873 0 defined $self->{'_data'} ? :
2978 0 3 unless ref $targ
2984 3 9 if ($objs[$i] == $targ)
2985 2 1 unless $i == 0
2992 0 3 unless $found
3000 0 6 unless ref $targ
3006 5 9 if ($objs[$i] == $targ)
3007 4 1 unless $i == $#objs
3014 1 5 unless $found
3044 1 4 if (not $found and $ref and $obj == $ref)
3051 1 1 unless $found
3067 2 7 if (not $found and $obj == $ref)
3073 0 2 unless $found
3083 0 2 unless ref $old and ref $new
3088 2 5 if ($objs[$i] == $old)
3096 2 0 $found ? :
3120 834 476 $rv ? :
3138 1319 17 if @_
3143 0 148 unless my $self = shift()
3147 0 148 if $sub eq 'DESTROY'
3152 148 0 if ($sub =~ /^(\w+)$/) { }
3156 9742 17259 if @_
3157 24908 2093 defined $$self{"_$subname"} ? :