Branch Coverage

blib/lib/Forks/Queue/File.pm
Criterion Covered Total %
branch 214 382 56.0


line true false branch
42 0 14435 if ($self->{'_locked'})
49 236 14199 if ($self->{'_lockdir'}) { }
14199 0 elsif ($self->{'lock'}) { }
51 0 236 if $_DEBUG
53 0 236 unless ($z)
69 0 14199 if $_DEBUG
79 236 14199 if ($self->{'_lockdir'}) { }
14199 0 elsif ($self->{'lockfh'}) { }
81 0 236 if $_DEBUG
84 0 14199 if $_DEBUG
96 0 14399 if &Forks::Queue::__inGD()
116 0 1917 $INC{'threads.pm'} ? :
147 0 93 unless open $fh, '>>', $opts{'lock'}
148 0 93 unless close $fh
154 0 93 if ($^O eq 'solaris') { }
0 93 elsif (${^_nfs}) { }
0 67 elsif (Forks::Queue::Util::__is_nfs($opts{'file'})) { }
162 11 56 if ($opts{'dflock'})
174 2 65 if ($opts{'join'} and -f $opts{'file'}) { }
176 0 2 unless open $fh, '+<', $opts{'file'}
181 4 61 if (-f $opts{'file'})
185 0 65 unless open $fh, '>', $opts{'file'}
186 0 65 unless close $fh
188 0 65 unless open $fh, '+<', $opts{'file'}
196 65 0 if (tell $fh < $self->{'_header_size'})
200 6 61 if (defined $list)
201 6 0 if (ref $list eq 'ARRAY') { }
216 0 90 if $_DEBUG
218 0 90 if (&Forks::Queue::__inGD()) { }
220 0 0 if (my $h = $self->_read_header)
221 0 0 if $_DEBUG
223 0 0 if ($role and $role eq 'P')
225 0 0 if $_DEBUG
233 90 0 if ($self->_read_header) { }
236 0 90 if $_DEBUG
239 0 90 if $_DEBUG
241 0 0 if $_DEBUG
245 0 90 if $_DEBUG
248 0 90 if ($@)
249 0 0 if (not $@ =~ /malformed JSON ...* at character offset 0/) { }
0 0 elsif ($_DEBUG) { }
257 90 0 if $self->{'_fh'}
259 0 90 if $_DEBUG
260 56 34 if ($self->{'_pids'} and 0 == keys %{$$self{'_pids'};})
261 0 56 if $_DEBUG
264 51 5 unless $self->{'persist'}
265 0 56 if $_DEBUG
267 0 56 if $_DEBUG
281 0 14377 unless $self->{'_locked'}
285 90 14287 if ($self->{'_DESTROY'}) { }
289 0 90 if $_DEBUG
293 14287 0 if (seek $self->{'_fh'}, 0, 0) { }
300 0 14377 unless ($h)
301 0 0 if ($self->{'_DESTROY'})
302 0 0 if $_DEBUG
318 14377 0 if $h->{'limit'}
320 0 14377 if $_DEBUG
328 0 1010 unless $self->{'_locked'}
338 111 899 $self->{'_lockdir'} ? :
351 0 1010 if $_DEBUG
356 0 660 unless $Forks::Queue::NOTIFY_OK
364 0 660 if $_DEBUG
367 0 1302 unless ($p)
370 642 660 if ($p != $$) { }
0 1320 elsif (defined $t and $id ne $me) { }
376 0 660 if (@tids)
377 0 0 if $_DEBUG
380 0 0 if ($thr) { }
0 0 elsif ($tid == 0) { }
382 0 0 if $thr and $z7 = $thr->kill('IO') and $_DEBUG
385 0 0 if ($tid ne $tids[-1])
392 0 0 if $_DEBUG
395 0 0 if $_DEBUG
400 426 234 if (@pids)
401 0 426 if $_DEBUG
408 0 62 unless (eval { do { $self->_check_pid; 1 } })
424 0 19 unless (eval { do { $self->_check_pid; 1 } })
430 0 19 if ($self->{'_end'}) { }
454 28 928 unless (defined $self->{'_pids'}{_PID()})
455 28 0 if ($Forks::Queue::NOTIFY_OK)
456 0 28 if (_PID() =~ /.-[1-9]/)
465 28 0 if $ostatus
469 0 28 unless ($ostatus)
474 0 28 if ($self->{'_locked'}) { }
475 0 0 if $_DEBUG
481 0 28 if $_DEBUG
496 0 0 if $min_size <= $self->{'_header_size'}
515 0 5 if $delta == 0
531 0 475 unless (eval { do { $self->_check_pid; 1 } })
540 5 470 if ($self->{'_end'})
547 159 311 if ($self->{'limit'} > 0)
549 120 39 if ($failed_items > 0) { }
551 4 116 if (@items == 0)
560 0 466 if (tell $self->{'_fh'} < $self->{'_tell'})
570 0 2981 if $self->_debug
575 0 475 if ($pushed and $self->_debug)
578 466 9 if $pushed
580 120 355 if ($failed_items)
581 49 71 if ($self->{'on_limit'} eq 'fail') { }
585 0 71 if $self->_debug
588 0 71 if $self->_debug
613 11881 99 unless ($ready)
624 0 137 if ($self->{'limit'} <= 0) { }
629 66 71 unless ($ready)
639 25 0 if @_
640 15 0 if ($self->{'style'} ne 'lifo') { }
641 15 0 @_ ? :
643 0 0 @_ ? :
649 0 0 @_ ? :
650 0 0 unless (eval { do { $self->_check_pid; 1 } })
658 0 0 if $self->{'_avail'} < $count and not $self->{'_end'}
671 0 0 if @return or $self->{'_end'} or $self->_expired
674 0 0 if @return
675 0 0 if ($self->_expired and @return == 0)
676 0 0 @_ ? :
678 0 0 @_ ? :
683 15 0 @_ ? :
684 0 15 unless (eval { do { $self->_check_pid; 1 } })
693 55 10 if $self->{'_avail'} < $count and not $self->{'_end'}
697 0 35 unless (defined $item)
705 0 35 if ($@)
713 0 10 if ($self->{'_maintenance_freq'} and $self->{'_pos'} >= $self->{'_maintenance_freq'})
720 5 50 if @return or $self->{'_end'} or $self->_expired
723 10 5 if @return
724 5 10 if ($self->_expired and @return == 0)
725 5 0 @_ ? :
727 10 0 @_ ? :
733 0 99 unless (eval { do { $self->_check_pid; 1 } })
741 9 90 unless $self->_wait_for_item
749 728 0 if (defined $item)
754 0 728 if ($@)
763 5 85 if ($self->{'_maintenance_freq'} and $self->{'_pos'} >= $self->{'_maintenance_freq'})
771 90 0 if @return
772 48 42 if (not wantarray and @_ < 2) { }
782 0 7 unless (eval { do { $self->_check_pid; 1 } })
797 0 20 unless (defined $item)
805 0 20 if ($@)
812 0 7 if ($self->{'_maintenance_freq'} and $self->{'_pos'} >= $self->{'_maintenance_freq'})
820 5 2 if @return
821 2 5 if (not wantarray and @_ < 2) { }
831 34 44 if ($index < 0)
834 0 44 unless (eval { do { $self->_check_pid; 1 } })
843 2 42 if $self->{'_avail'} <= $index
852 0 344 unless (defined $item)
866 0 40 if ($index < 0)
869 0 40 unless (eval { do { $self->_check_pid; 1 } })
880 5 35 if $self->{'_avail'} <= $index
897 48 4 if @_
899 26 20 if @_
903 18 18 if ($self->{'style'} eq 'lifo')
912 0 36 if ($count <= 0)
916 18 18 if ($index < 0)
918 8 10 if ($index < 0)
923 8 28 if ($count <= 0 or $index >= $n)
926 6 22 if ($index + $count >= $n)
946 28 8 if @return
947 16 20 @_ ? :
953 0 20 unless (eval { do { $self->_check_pid; 1 } })
963 0 20 if ($self->{'_end'})
968 20 0 if ($self->{'limit'} > 0)
970 4 16 if ($failed_items > 0) { }
972 0 4 if (@items == 0)
980 8 12 if ($pos < 0)
983 4 16 if ($pos >= $self->{'_avail'})
986 0 4 if (tell $self->{'_fh'} < $self->{'_tell'})
995 0 16 if $self->_debug
1001 4 12 if ($pos < 0)
1017 0 48 if $self->_debug
1023 0 20 if ($failed_items)
1024 0 0 if ($self->{'on_limit'} eq 'fail') { }
1028 0 0 if $self->_debug
1031 0 0 if $self->_debug
1035 20 0 if $inserted
1042 0 22 unless (eval { do { $self->_check_pid; 1 } })
1055 0 22 if $self->{'_end'} and not $self->{'_avail'}
1060 5 17 if ($self->{'_avail'} <= $count) { }
1082 22 0 if @return
1083 2 20 if (not wantarray and @_ < 2) { }
1093 0 4 unless (eval { do { $self->_check_pid; 1 } })
1101 0 4 if $self->{'_end'} and not $self->{'_avail'}
1107 4 0 if ($self->{'_avail'} <= $count)
1131 0 4 if @return
1132 4 0 if (not wantarray and @_ < 2) { }
1161 0 149 unless (eval { do { $self->_check_pid; 1 } })
1165 15 134 unless ($self->{'_limit_magic'})
1169 43 106 if (@_)
1171 28 15 if (@_)
1199 0 51 if ($^O eq 'MSWin32') { }
1210 204 51 unless defined $candidate
1211 51 0 if (-d $candidate and -w _ and -x _)
1213 0 40 if Forks::Queue::Util::__is_nfs($candidate)