Branch Coverage

blib/script/plockf
Criterion Covered Total %
branch 47 74 63.5


line true false branch
36 3 1 if ($msg)
61 1 19 if (defined $timeout and $timeout < 0)
65 1 18 unless my $lock_file = shift @ARGV
67 1 17 unless my $cmd = shift @ARGV
74 3 14 if (defined $timeout and $timeout > 0)
76 1 2 if (not $timeout =~ /^\d+$/ and eval { do { require Time::HiRes; 'Time::HiRes'->VERSION(1.9716); 'Time::HiRes'->import('ualarm'); 1 } }) { }
79 0 2 if ($timeout < 1)
87 0 4 if ($^O eq 'MSWin32') { }
1 3 elsif ($keep) { }
99 3 13 if ($alarm)
103 3 13 unless ($lock_fh)
112 0 10 if ($? == -1) { }
1 9 elsif ($? & 127) { }
123 10 12 if ($do_cleanup)
130 0 17 if ($] < 5.01 and eval { do { &Fcntl::O_EXLOCK } } and eval { do { &Fcntl::O_NONBLOCK } } or $] >= 5.01 and defined &Fcntl::O_EXLOCK and defined &Fcntl::O_NONBLOCK) { }
17 0 elsif ($] < 5.01 and eval { do { &Fcntl::LOCK_EX } } and eval { do { &Fcntl::LOCK_NB } } or $] >= 5.01 and defined &Fcntl::LOCK_EX and defined &Fcntl::LOCK_NB) { }
146 0 0 $block ? :
0 0 $nocreat ? :
0 0 unless (sysopen $lock_fh, $lock_file, &Fcntl::O_RDONLY | ($block ? 0 : &Fcntl::O_NONBLOCK) | &Fcntl::O_EXLOCK | ($nocreat ? 0 : &Fcntl::O_CREAT), 438)
147 0 0 if ($!{'EAGAIN'} or $!{'EINTR'})
150 0 0 if ($nocreat and $!{'ENOENT'}) { }
167 1 20 $nocreat ? :
1 20 unless (sysopen $lock_fh, $lock_file, &Fcntl::O_RDONLY | ($nocreat ? 0 : &Fcntl::O_CREAT), 438)
168 0 1 if ($!{'EAGAIN'} or $!{'EINTR'})
171 1 0 if ($nocreat and $!{'ENOENT'}) { }
177 1 19 $block ? :
7 13 unless (flock $lock_fh, ($block ? 0 : &Fcntl::LOCK_NB) | &Fcntl::LOCK_EX)
180 10 3 unless ($keep)
182 0 10 unless (@stat_file)
186 10 0 if ($^O ne "MSWin32")
188 0 10 if ($stat_fh[1] != $stat_file[1] or $stat_fh[0] != $stat_file[0])
198 3 0 if (sysopen my $fh, $lock_file, &Fcntl::O_RDONLY)
205 0 0 if $timed_out
206 0 0 if (sysopen my $fh, $lock_file, &Fcntl::O_RDONLY)
207 0 0 if flock $fh, &Fcntl::LOCK_EX | &Fcntl::LOCK_NB
215 3 1 unless ($silent)
216 1 2 if ($exit == 69) { }