Branch Coverage

blib/lib/Forks/Queue/File.pm
Criterion Covered Total %
branch 220 392 56.1


line true false branch
41 0 16437 if ($self->{'_locked'})
48 243 16194 if ($self->{'_lockdir'}) { }
16194 0 elsif ($self->{'lock'}) { }
50 0 243 if $_DEBUG
52 0 243 unless ($z)
68 0 16194 if $_DEBUG
78 243 16194 if ($self->{'_lockdir'}) { }
16194 0 elsif ($self->{'lockfh'}) { }
80 0 243 if $_DEBUG
83 0 16194 if $_DEBUG
95 0 16401 if &Forks::Queue::__inGD()
115 0 1942 $INC{'threads.pm'} ? :
146 0 93 unless open my $fh1, '>>', $opts{'lock'}
147 0 93 unless close $fh1
153 0 93 if ($^O eq 'solaris') { }
0 93 elsif (${^_nfs}) { }
0 67 elsif (Forks::Queue::Util::__is_nfs($opts{'file'})) { }
161 11 56 if ($opts{'dflock'})
173 2 65 if ($opts{'join'} and -f $opts{'file'}) { }
175 0 2 unless open my $fh2, '+<', $opts{'file'}
180 4 61 if (-f $opts{'file'})
185 0 65 unless open my $fh3, '>', $opts{'file'}
186 0 65 unless close $fh3
188 0 65 unless open my $fh4, '+<', $opts{'file'}
196 65 0 if (tell $fh4 < $self->{'_header_size'})
200 6 61 if (defined $list)
201 6 0 if (ref $list eq 'ARRAY') { }
216 0 85 if $_DEBUG
218 0 85 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 85 0 if ($self->_read_header) { }
236 0 85 if $_DEBUG
239 0 85 if $_DEBUG
241 0 0 if $_DEBUG
245 0 85 if $_DEBUG
248 0 85 if ($@)
249 0 0 if (not $@ =~ /malformed JSON ...* at character offset 0/) { }
0 0 elsif ($_DEBUG) { }
257 85 0 if $self->{'_fh'}
259 0 85 if $_DEBUG
260 54 31 if ($self->{'_pids'} and 0 == keys %{$$self{'_pids'};})
261 0 54 if $_DEBUG
264 49 5 unless $self->{'persist'}
265 0 54 if $_DEBUG
267 0 54 if $_DEBUG
281 0 16379 unless $self->{'_locked'}
285 85 16294 if ($self->{'_DESTROY'}) { }
289 0 85 if $_DEBUG
293 16294 0 if (seek $self->{'_fh'}, 0, 0) { }
300 0 16379 unless ($h)
301 0 0 if ($self->{'_DESTROY'})
302 0 0 if $_DEBUG
318 16379 0 if $h->{'limit'}
320 0 16379 if $_DEBUG
328 0 1005 unless $self->{'_locked'}
338 111 894 $self->{'_lockdir'} ? :
351 0 1005 if $_DEBUG
356 0 660 unless $Forks::Queue::NOTIFY_OK
364 0 660 if $_DEBUG
367 0 1336 unless ($p)
370 676 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 438 222 if (@pids)
401 0 438 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 958 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'})
548 159 311 if ($self->{'limit'} > 0)
549 4 155 if ($Forks::Queue::File::_ENQUEUE) { }
550 0 4 if ($self->{'_avail'} >= $self->{'limit'})
556 120 35 if ($failed_items > 0) { }
558 4 116 if (@items == 0)
567 466 0 if (@items > 0)
569 0 466 if (tell $self->{'_fh'} < $self->{'_tell'})
579 0 2981 if $self->_debug
585 0 475 if ($pushed and $self->_debug)
588 466 9 if $pushed
590 120 355 if ($failed_items)
591 49 71 if ($self->{'on_limit'} eq 'fail') { }
595 0 71 if $self->_debug
598 0 71 if $self->_debug
630 13884 99 unless ($ready)
641 0 142 if ($self->{'limit'} <= 0) { }
646 71 71 unless ($ready)
656 25 0 if @_
657 15 0 if ($self->{'style'} ne 'lifo') { }
658 15 0 @_ ? :
660 0 0 @_ ? :
666 0 0 @_ ? :
667 0 0 unless (eval { do { $self->_check_pid; 1 } })
671 0 0 if ($self->limit > 0 and $count > $self->limit)
680 0 0 if $self->{'_avail'} < $count and not $self->{'_end'}
693 0 0 if @return or $self->{'_end'} or $self->_expired
696 0 0 if @return
697 0 0 if ($self->_expired and @return == 0)
698 0 0 @_ ? :
700 0 0 @_ ? :
705 15 0 @_ ? :
706 0 15 unless (eval { do { $self->_check_pid; 1 } })
710 0 15 if ($self->limit > 0 and $count > $self->limit)
720 50 10 if $self->{'_avail'} < $count and not $self->{'_end'}
724 0 35 unless (defined $item)
732 0 35 if ($@)
740 0 10 if ($self->{'_maintenance_freq'} and $self->{'_pos'} >= $self->{'_maintenance_freq'})
747 5 45 if @return or $self->{'_end'} or $self->_expired
750 10 5 if @return
751 5 10 if ($self->_expired and @return == 0)
752 5 0 @_ ? :
754 10 0 @_ ? :
760 0 99 unless (eval { do { $self->_check_pid; 1 } })
768 9 90 unless $self->_wait_for_item
776 728 0 if (defined $item)
781 0 728 if ($@)
790 5 85 if ($self->{'_maintenance_freq'} and $self->{'_pos'} >= $self->{'_maintenance_freq'})
798 90 0 if @return
799 48 42 if (not wantarray and @_ < 2) { }
809 0 7 unless (eval { do { $self->_check_pid; 1 } })
824 0 20 unless (defined $item)
832 0 20 if ($@)
839 0 7 if ($self->{'_maintenance_freq'} and $self->{'_pos'} >= $self->{'_maintenance_freq'})
847 5 2 if @return
848 2 5 if (not wantarray and @_ < 2) { }
858 20 51 if ($index < 0)
861 0 51 unless (eval { do { $self->_check_pid; 1 } })
870 2 49 if $self->{'_avail'} <= $index
879 0 351 unless (defined $item)
893 10 48 if ($index < 0)
896 0 48 unless (eval { do { $self->_check_pid; 1 } })
907 5 43 if $self->{'_avail'} <= $index
924 48 4 if @_
926 26 20 if @_
930 18 18 if ($self->{'style'} eq 'lifo')
939 0 36 if ($count <= 0)
943 18 18 if ($index < 0)
945 8 10 if ($index < 0)
950 8 28 if ($count <= 0 or $index >= $n)
953 6 22 if ($index + $count >= $n)
973 28 8 if @return
974 16 20 @_ ? :
980 0 20 unless (eval { do { $self->_check_pid; 1 } })
990 0 20 if ($self->{'_end'})
995 20 0 if ($self->{'on_limit'} ne 'tq-compat' and $self->{'limit'} > 0)
997 4 16 if ($failed_items > 0) { }
999 0 4 if (@items == 0)
1007 8 12 if ($pos < 0)
1010 4 16 if ($pos >= $self->{'_avail'})
1013 0 4 if (tell $self->{'_fh'} < $self->{'_tell'})
1022 0 16 if $self->_debug
1028 4 12 if ($pos < 0)
1044 0 48 if $self->_debug
1050 0 20 if ($failed_items)
1051 0 0 if ($self->{'on_limit'} eq 'fail') { }
1055 0 0 if $self->_debug
1058 0 0 if $self->_debug
1062 20 0 if $inserted
1069 0 22 unless (eval { do { $self->_check_pid; 1 } })
1082 0 22 if $self->{'_end'} and not $self->{'_avail'}
1087 5 17 if ($self->{'_avail'} <= $count) { }
1109 22 0 if @return
1110 2 20 if (not wantarray and @_ < 2) { }
1120 0 4 unless (eval { do { $self->_check_pid; 1 } })
1128 0 4 if $self->{'_end'} and not $self->{'_avail'}
1134 4 0 if ($self->{'_avail'} <= $count)
1158 0 4 if @return
1159 4 0 if (not wantarray and @_ < 2) { }
1188 0 164 unless (eval { do { $self->_check_pid; 1 } })
1192 20 144 unless ($self->{'_limit_magic'})
1196 43 121 if (@_)
1198 28 15 if (@_)
1226 0 51 if ($^O eq 'MSWin32') { }
1237 204 51 unless defined $candidate
1238 51 0 if (-d $candidate and -w _ and -x _)
1240 0 40 if Forks::Queue::Util::__is_nfs($candidate)