Branch Coverage

blib/lib/Forks/Queue/File.pm
Criterion Covered Total %
branch 221 396 55.8


line true false branch
41 0 15659 if ($self->{'_locked'})
48 256 15403 if ($self->{'_lockdir'}) { }
15403 0 elsif ($self->{'lock'}) { }
50 0 256 if $_DEBUG
52 0 0 unless ($z or $self->{'_DESTROY'})
69 0 15403 if $_DEBUG
80 256 15403 if ($self->{'_lockdir'}) { }
15403 0 elsif ($self->{'lockfh'}) { }
82 0 256 if $_DEBUG
85 0 15403 if $_DEBUG
97 0 15623 if &Forks::Queue::__inGD()
103 15623 0 if $self->{'__locked'} or not $self->{'_DESTROY'}
118 0 1942 $INC{'threads.pm'} ? :
149 0 93 unless open my $fh1, '>>', $opts{'lock'}
150 0 93 unless close $fh1
156 0 93 if ($^O eq 'solaris' or $^O eq 'aix') { }
0 93 elsif (${^_nfs}) { }
0 67 elsif (Forks::Queue::Util::__is_nfs($opts{'file'})) { }
164 11 56 if ($opts{'dflock'})
175 2 65 if ($opts{'join'} and -f $opts{'file'}) { }
177 0 2 unless open my $fh2, '+<', $opts{'file'}
182 4 61 if (-f $opts{'file'})
187 0 65 unless open my $fh3, '>', $opts{'file'}
188 0 65 unless close $fh3
190 0 65 unless open my $fh4, '+<', $opts{'file'}
194 11 54 if ($opts{'dflock'})
201 65 0 if (tell $fh4 < $self->{'_header_size'})
205 6 61 if (defined $list)
206 6 0 if (ref $list eq 'ARRAY') { }
220 0 85 if $_DEBUG
222 0 85 if (&Forks::Queue::__inGD()) { }
224 0 0 if (my $h = $self->_read_header)
225 0 0 if $_DEBUG
227 0 0 if ($role and $role eq 'P')
229 0 0 if $_DEBUG
237 85 0 if ($self->_read_header) { }
240 0 85 if $_DEBUG
243 0 85 if $_DEBUG
245 0 0 if $_DEBUG
249 0 85 if $_DEBUG
252 0 85 if ($@)
253 0 0 if (not $@ =~ /malformed JSON ...* at character offset 0/) { }
0 0 elsif ($_DEBUG) { }
261 85 0 if $self->{'_fh'}
263 0 85 if $_DEBUG
264 49 36 if ($self->{'_pids'} and 0 == keys %{$$self{'_pids'};} and not $self->{'persist'})
265 0 49 if $_DEBUG
268 49 0 unless $self->{'persist'}
269 0 49 if $_DEBUG
271 0 49 if $_DEBUG
285 0 15601 unless $self->{'_locked'}
289 85 15516 if ($self->{'_DESTROY'}) { }
293 0 85 if $_DEBUG
297 15516 0 if (seek $self->{'_fh'}, 0, 0) { }
304 0 15601 unless ($h)
305 0 0 if ($self->{'_DESTROY'})
306 0 0 if $_DEBUG
322 15601 0 if $h->{'limit'}
324 0 15601 if $_DEBUG
332 0 1005 unless $self->{'_locked'}
342 111 894 $self->{'_lockdir'} ? :
355 0 1005 if $_DEBUG
360 0 660 unless $Forks::Queue::NOTIFY_OK
368 0 660 if $_DEBUG
371 0 1242 unless ($p)
374 582 660 if ($p != $$) { }
0 1320 elsif (defined $t and $id ne $me) { }
380 0 660 if (@tids)
381 0 0 if $_DEBUG
384 0 0 if ($thr) { }
0 0 elsif ($tid == 0) { }
386 0 0 if $thr and $z7 = $thr->kill('IO') and $_DEBUG
389 0 0 if ($tid ne $tids[-1])
396 0 0 if $_DEBUG
399 0 0 if $_DEBUG
404 405 255 if (@pids)
405 0 405 if $_DEBUG
412 0 62 unless (eval { do { $self->_check_pid; 1 } })
428 0 19 unless (eval { do { $self->_check_pid; 1 } })
434 0 19 if ($self->{'_end'}) { }
458 28 958 unless (defined $self->{'_pids'}{_PID()})
459 28 0 if ($Forks::Queue::NOTIFY_OK)
460 0 28 if (_PID() =~ /.-[1-9]/)
469 28 0 if $ostatus
473 0 28 unless ($ostatus)
478 0 28 if ($self->{'_locked'}) { }
479 0 0 if $_DEBUG
485 0 28 if $_DEBUG
500 0 0 if $min_size <= $self->{'_header_size'}
519 0 5 if $delta == 0
535 0 475 unless (eval { do { $self->_check_pid; 1 } })
544 5 470 if ($self->{'_end'})
552 159 311 if ($self->{'limit'} > 0)
553 4 155 if ($Forks::Queue::File::_ENQUEUE) { }
554 0 4 if ($self->{'_avail'} >= $self->{'limit'})
560 120 35 if ($failed_items > 0) { }
562 4 116 if (@items == 0)
571 466 0 if (@items > 0)
573 0 466 if (tell $self->{'_fh'} < $self->{'_tell'})
583 0 2981 if $self->_debug
589 0 475 if ($pushed and $self->_debug)
592 466 9 if $pushed
594 120 355 if ($failed_items)
595 49 71 if ($self->{'on_limit'} eq 'fail') { }
599 0 71 if $self->_debug
602 0 71 if $self->_debug
634 13081 99 unless ($ready)
645 0 142 if ($self->{'limit'} <= 0) { }
650 71 71 unless ($ready)
660 25 0 if @_
661 15 0 if ($self->{'style'} ne 'lifo') { }
662 15 0 @_ ? :
664 0 0 @_ ? :
670 0 0 @_ ? :
671 0 0 unless (eval { do { $self->_check_pid; 1 } })
675 0 0 if ($self->limit > 0 and $count > $self->limit)
684 0 0 if $self->{'_avail'} < $count and not $self->{'_end'}
697 0 0 if @return or $self->{'_end'} or $self->_expired
700 0 0 if @return
701 0 0 if ($self->_expired and @return == 0)
702 0 0 @_ ? :
704 0 0 @_ ? :
709 15 0 @_ ? :
710 0 15 unless (eval { do { $self->_check_pid; 1 } })
714 0 15 if ($self->limit > 0 and $count > $self->limit)
724 52 10 if $self->{'_avail'} < $count and not $self->{'_end'}
728 0 35 unless (defined $item)
736 0 35 if ($@)
744 0 10 if ($self->{'_maintenance_freq'} and $self->{'_pos'} >= $self->{'_maintenance_freq'})
751 5 47 if @return or $self->{'_end'} or $self->_expired
754 10 5 if @return
755 5 10 if ($self->_expired and @return == 0)
756 5 0 @_ ? :
758 10 0 @_ ? :
764 0 99 unless (eval { do { $self->_check_pid; 1 } })
772 9 90 unless $self->_wait_for_item
780 728 0 if (defined $item)
785 0 728 if ($@)
794 5 85 if ($self->{'_maintenance_freq'} and $self->{'_pos'} >= $self->{'_maintenance_freq'})
802 90 0 if @return
803 48 42 if (not wantarray and @_ < 2) { }
813 0 7 unless (eval { do { $self->_check_pid; 1 } })
828 0 20 unless (defined $item)
836 0 20 if ($@)
843 0 7 if ($self->{'_maintenance_freq'} and $self->{'_pos'} >= $self->{'_maintenance_freq'})
851 5 2 if @return
852 2 5 if (not wantarray and @_ < 2) { }
862 20 51 if ($index < 0)
865 0 51 unless (eval { do { $self->_check_pid; 1 } })
874 2 49 if $self->{'_avail'} <= $index
883 0 351 unless (defined $item)
897 10 48 if ($index < 0)
900 0 48 unless (eval { do { $self->_check_pid; 1 } })
911 5 43 if $self->{'_avail'} <= $index
928 48 4 if @_
930 26 20 if @_
934 18 18 if ($self->{'style'} eq 'lifo')
943 0 36 if ($count <= 0)
947 18 18 if ($index < 0)
949 8 10 if ($index < 0)
954 8 28 if ($count <= 0 or $index >= $n)
957 6 22 if ($index + $count >= $n)
977 28 8 if @return
978 16 20 @_ ? :
984 0 20 unless (eval { do { $self->_check_pid; 1 } })
994 0 20 if ($self->{'_end'})
999 20 0 if ($self->{'on_limit'} ne 'tq-compat' and $self->{'limit'} > 0)
1001 4 16 if ($failed_items > 0) { }
1003 0 4 if (@items == 0)
1011 8 12 if ($pos < 0)
1014 4 16 if ($pos >= $self->{'_avail'})
1017 0 4 if (tell $self->{'_fh'} < $self->{'_tell'})
1026 0 16 if $self->_debug
1032 4 12 if ($pos < 0)
1048 0 48 if $self->_debug
1054 0 20 if ($failed_items)
1055 0 0 if ($self->{'on_limit'} eq 'fail') { }
1059 0 0 if $self->_debug
1062 0 0 if $self->_debug
1066 20 0 if $inserted
1073 0 22 unless (eval { do { $self->_check_pid; 1 } })
1086 0 22 if $self->{'_end'} and not $self->{'_avail'}
1091 5 17 if ($self->{'_avail'} <= $count) { }
1113 22 0 if @return
1114 2 20 if (not wantarray and @_ < 2) { }
1124 0 4 unless (eval { do { $self->_check_pid; 1 } })
1132 0 4 if $self->{'_end'} and not $self->{'_avail'}
1138 4 0 if ($self->{'_avail'} <= $count)
1162 0 4 if @return
1163 4 0 if (not wantarray and @_ < 2) { }
1192 0 164 unless (eval { do { $self->_check_pid; 1 } })
1196 20 144 unless ($self->{'_limit_magic'})
1200 43 121 if (@_)
1202 28 15 if (@_)
1230 0 51 if ($^O eq 'MSWin32') { }
1241 204 51 unless defined $candidate
1242 51 0 if (-d $candidate and -w _ and -x _)
1244 0 40 if Forks::Queue::Util::__is_nfs($candidate)