Branch Coverage

lib/Log/Unrotate/Cursor/File.pm
Criterion Covered Total %
branch 65 84 77.3


line true false branch
61 0 108 unless defined $file
65 108 0 if ($options)
69 1 107 unless $_lock_values{$lock}
70 0 107 if $rollback and not $rollback =~ /^\d+$/
77 4 103 unless ($lock eq 'none')
79 0 4 unless (open $$self{'lock_fh'}, '>>', "$$self{'file'}.lock")
83 1 3 if ($lock eq 'blocking') { }
3 0 elsif ($lock eq 'nonblocking') { }
84 0 1 unless flock $$self{'lock_fh'}, 2
87 1 2 unless flock $$self{'lock_fh'}, 6
100 63 43 unless -e $file
102 0 43 unless open my $fh, '<', $file
108 150 106 if ($line =~ /^\s*(inode|committime|position):\s*(\d+)/) { }
94 12 elsif ($line =~ /^\s*(logfile|lastline):\s(.*)/) { }
10 2 elsif ($line =~ /^###$/) { }
110 0 150 if (defined $$pos{$field})
116 0 94 if (defined $$pos{$field})
121 0 10 unless defined $$pos{'Position'}
126 40 3 if ($pos and scalar keys %$pos)
127 0 40 unless defined $$pos{'Position'}
130 3 40 unless scalar @poss
137 50 91 unless defined $$self{'positions'}
150 52 89 unless $first
154 141 0 if ($$pos{'Inode'})
157 139 2 if ($$pos{'LastLine'})
165 1 705 unless (grep {$_ eq $field;} values %_text2field)
169 1 140 if scalar @to_clean
172 0 89 if ($fh->error)
176 0 89 unless chmod 0644, $fh->filename
177 0 89 unless rename $fh->filename, $$self{'file'}
187 38 48 unless ($poss)
192 5 2 if ($$poss[0]{'Position'} == $$pos{'Position'} and $$poss[0]{'LastLine'} eq $$pos{'LastLine'} and $$poss[0]{'Inode'} == $$pos{'Inode'})
198 21 22 if ($times[0] > $$self{'rollback'} or scalar @times == 1) { }
14 8 elsif ($times[1] <= $$self{'rollback'}) { }
8 0 elsif ($times[1] > $$self{'rollback'}) { }
212 0 94 unless defined $$pos{'Position'}
213 86 8 if $$self{'rollback'}
221 1 36 unless $$self{'positions'}
222 19 17 unless scalar @{$$self{'positions'};} > 1
230 0 3 unless -e $$self{'file'}
231 0 3 unless unlink $$self{'file'}
237 4 103 if ($$self{'lock_fh'})