Branch Coverage

blib/lib/File/NFSLock.pm
Criterion Covered Total %
branch 66 86 76.7


line true false branch
79 1134 33 if (@_ and ref $_[0]) { }
94 2246 88 if (not $SIG{$signal} or $SIG{$signal} eq 'DEFAULT')
101 0 1167 if ($$self{'lock_type'} and not $$self{'lock_type'} =~ /^\d+/ and exists $$TYPES{$$self{'lock_type'}})
108 68 1099 unless ($HOSTNAME)
114 0 1167 unless length $$self{'file'}
119 0 1167 unless $$self{'lock_type'} and $$self{'lock_type'} =~ /^\d+$/
131 70 1097 $$self{'blocking_timeout'} && !($$self{'lock_type'} & 4) ? :
136 0 104 if (-e $$self{'lock_file'} and $$self{'stale_lock_timeout'} > 0 and time - (stat _)[9] > $$self{'stale_lock_timeout'})
144 0 1342 unless $self->create_magic
147 1313 29 if ($$self{'lock_type'} & 2) { }
29 0 elsif ($$self{'lock_type'} & 1) { }
148 1128 185 if $self->do_lock
150 27 2 if $self->do_lock_shared
164 153 34 if (-e $$self{'lock_file'} and open $fh, '+<', $$self{'lock_file'})
175 153 0 if ($line =~ /^\Q$HOSTNAME\E (-?\d+) /) { }
177 1 152 if ($pid == $$) { }
150 2 elsif (kill 0, $pid) { }
190 2 151 if (@dead) { }
205 2 0 if ($line =~ /^\Q$HOSTNAME\E (-?\d+) /)
207 2 0 unless kill 0, $pid
213 0 2 if (length $content) { }
234 1 152 if ($try_lock_exclusive eq $has_lock_exclusive and @mine)
241 11 175 if ($$self{'lock_type'} & 4)
250 0 175 if ($quit_time and time > $quit_time)
273 1155 32 unless ($$self{'unlocked'})
274 0 1155 if -e $$self{'rand_file'}
275 33 1122 if ($$self{'lock_type'} & 1) { }
282 2240 70 if ($SIG{$signal} and $SIG{$signal} eq $graceful_sig)
312 0 1370 unless (open my $fh, '>>', $append_file)
324 0 1313 unless chmod $chmod, $rand_file
345 0 29 unless chmod $chmod, $rand_file
366 2 27 if (not $success and -e $lock_file and ((stat _)[2] & $SHARE_BIT) != $SHARE_BIT) { }
20 7 elsif (not $success) { }
398 0 33 unless (open $fh, '+<', $lock_file)
399 0 0 if (not -e $lock_file) { }
409 33 218 if $line eq $lock_line
414 28 5 if (length $content) { }
431 1155 0 if ref $file
441 4 8 if ($$self{'lock_pid'} == $$) { }
448 4 42 if (rename "$$self{'lock_file'}.fork", $$self{'rand_file'})
462 2 2 unless ($$self{'lock_type'} & 1)
485 4 4 unless ($$self{'lock_type'} & 1)
506 6 0 if (defined $pid and not $$self{'unlocked'})