Branch Coverage

blib/lib/MCE/Child.pm
Criterion Covered Total %
branch 177 406 43.6


line true false branch
33 12 0 unless ((caller) =~ /^MCE::/)
44 0 0 $^O eq 'solaris' ? :
12 0 $INC{'POSIX.pm'} ? :
54 0 0 if $INC{'threads.pm'}
63 1 9 if ($cpus eq 'auto') { }
6 3 elsif ($cpus =~ /^([0-9.]+)%$/) { }
70 3 7 if not $cpus =~ /^[\d\.]+$/ or $cpus < 1
83 8 11 if defined $_[0] and $_[0] eq "MCE::Child"
89 11 8 caller eq 'MCE::Child' ? :
90 0 19 ref $_[0] eq 'HASH' ? :
97 7 12 if exists $_LIST->{$pkg}
99 12 7 unless (exists $_LIST->{$pkg})
100 0 0 if $_tid and $MCE::_GMUTEX
101 0 12 if $_tid
104 0 12 if $INC{'MCE/Shared.pm'}
113 0 0 if $_tid and $MCE::_GMUTEX
116 19 0 unless (exists $mngd->{'posix_exit'})
122 0 19 if $^S or $_tid or $INC{'Mojo/IOLoop.pm'} or $INC{'Coro.pm'} or $INC{'LWP/UserAgent.pm'} or $INC{'stfl.pm'} or $INC{'Curses.pm'} or $INC{'CGI.pm'} or $INC{'FCGI.pm'} or $INC{'Tk.pm'} or $INC{'Wx.pm'} or $INC{'Win32/GUI.pm'} or $INC{'Gearman/Util.pm'} or $INC{'Gearman/XS.pm'}
126 3 16 if (defined $mngd->{'max_workers'})
130 0 19 if ($INC{'LWP/UserAgent.pm'} and not $INC{'Net/HTTP.pm'})
135 0 5 if $mngd->{'on_finish'} and not $INC{'POSIX.pm'} and not $_is_MSWin32
163 65 0 if $_[0] eq "MCE::Child"
167 0 65 ref $_[0] eq 'HASH' ? :
169 0 65 if $SIG{'CHLD'} eq "IGNORE"
171 0 65 if not ref $_[0] and ref $_[1] eq "CODE"
173 0 0 if not ref $func and length $func and index($func, ":") < 0
176 0 65 unless (defined $func)
185 0 65 if (my $id = ++$$_DATA{"${pkg}:id"}) >= 2000000000
195 0 65 if ($max_workers or $self->{'IGNORE'})
197 0 0 if ($max_workers and $list->len >= $max_workers)
205 0 0 if $_tid and $MCE::_GMUTEX
212 65 0 if not $_is_MSWin32 and $] ge "5.010001"
215 65 0 unless $_is_MSWin32
219 0 65 if (not defined $pid) { }
55 10 elsif ($pid) { }
225 10 45 if $mngd->{'on_start'}
235 0 10 if $INC{'MCE/Shared.pm'}
236 10 0 unless $self->{'IGNORE'}
237 0 10 if $killed
247 0 10 if ($INC{'Math/Prime/Util.pm'})
253 0 10 if ($INC{'Math/Random.pm'})
255 0 0 $cur_seed < 1073741781 ? :
262 0 10 if ($INC{'Math/Random/MT/Auto.pm'})
264 0 0 $cur_seed < 1073741781 ? :
275 0 0 if $_tid and $MCE::_GMUTEX
277 0 55 if $killed
279 55 0 $pid ? :
289 0 0 unless ref $_[0] and ref $_[1]
290 0 0 $_[0]{'WRK_ID'} == $_[1]{'WRK_ID'} ? :
294 0 31 unless ref(my $self = $_[0])
295 0 31 unless $self->{'REAPED'}
296 31 0 unless $self->{'ERROR'}
300 0 10 if defined $_[0] and $_[0] eq "MCE::Child"
302 10 0 ref $_[0] ? :
305 0 10 if ($wrk_id == $$ and $self->{'MGR_ID'} eq "$$.$_tid") { }
0 10 elsif ($wrk_id == $$) { }
310 0 0 @res ? :
315 0 10 if $self->{'REAPED'}
317 10 0 if (exists $_DATA->{$pkg}) { }
323 0 10 if ($_is_MSWin32) { }
324 0 0 if CORE::kill "ZERO", $wrk_id
326 10 0 if CORE::kill "ZERO", $wrk_id
333 0 26 if ref $_[0]
334 26 0 if defined $_[0] and $_[0] eq "MCE::Child"
336 25 1 defined $_[0] ? :
338 23 3 if ($pkg eq 'MCE') { }
2 1 elsif (exists $_LIST->{$pkg}) { }
342 0 2 if $MCE::Signal::KILLED
344 2 0 if (exists $_DELY->{$pkg})
358 0 24 unless ref(my $self = $_[0])
361 0 24 if ($wrk_id == $$) { }
24 0 elsif ($self->{'MGR_ID'} eq "$$.$_tid") { }
365 0 24 if $self->{'REAPED'}
367 24 0 waitpid($wrk_id, 1) == 0 ? :
368 0 0 unless $self->{'REAPED'}
379 0 24 unless ref(my $self = $_[0])
382 0 24 if ($wrk_id == $$) { }
24 0 elsif ($self->{'MGR_ID'} eq "$$.$_tid") { }
386 0 24 if $self->{'REAPED'}
388 24 0 waitpid($wrk_id, 1) == 0 ? :
389 0 0 unless $self->{'REAPED'}
400 0 41 unless ref(my $self = $_[0])
403 0 41 if ($self->{'REAPED'})
404 0 0 unless exists $self->{'RESULT'}
405 0 0 if exists $_LIST->{$pkg}
408 0 0 wantarray ? :
0 0 defined wantarray ? :
412 0 41 if ($wrk_id == $$) { }
41 0 elsif ($self->{'MGR_ID'} eq "$$.$_tid") { }
426 0 41 unless exists $self->{'RESULT'}
429 0 39 wantarray ? :
39 2 defined wantarray ? :
434 0 5 unless ref(my $self = $_[0])
437 0 5 if ($wrk_id == $$)
441 5 0 if ($self->{'MGR_ID'} eq "$$.$_tid")
442 0 5 if $self->{'REAPED'}
443 5 0 if (exists $_DATA->{$pkg}) { }
450 5 0 if CORE::kill "ZERO", $wrk_id
456 0 8 if ref $_[0]
459 8 0 exists $_LIST->{$pkg} ? :
463 0 8 if ref $_[0]
466 8 0 exists $_LIST->{$pkg} ? :
470 0 8 if ref $_[0]
473 0 8 unless my $list = $_LIST->{$pkg}
479 24 0 waitpid($_->{'WRK_ID'}, 1) == 0 ? :
480 0 0 unless $_->{'REAPED'}
488 0 8 if ref $_[0]
491 0 8 unless my $list = $_LIST->{$pkg}
497 24 0 waitpid($_->{'WRK_ID'}, 1) == 0 ? :
498 0 0 unless $_->{'REAPED'}
506 0 17 if ref $_[0]
511 17 0 if $_[0] eq "MCE::Child"
513 7 10 if @_
518 0 8 if ref $_[0]
521 8 0 exists $_LIST->{$pkg} ? :
525 31 0 ref $_[0] ? :
529 0 7 unless ref(my $self = $_[0])
530 0 7 unless $self->{'REAPED'}
532 0 7 unless exists $self->{'RESULT'}
533 0 7 wantarray ? :
537 0 0 ref $_[0] ? :
541 0 1 if ref $_[0]
545 0 0 wantarray ? :
0 1 unless exists $_LIST->{$pkg} and $_LIST->{$pkg}->len
549 0 1 wantarray ? :
555 0 4 if ref $_[0]
559 0 4 unless exists $_LIST->{$pkg} and $_LIST->{$pkg}->len
567 0 0 if ref $_[0]
568 0 0 if defined $_[0] and $_[0] eq "MCE::Child"
578 0 0 unless $_DELY->{$pkg}
591 0 0 if ($INC{'MCE.pm'}) { }
606 0 10 if $_is_MSWin32
610 10 0 if defined fileno STDERR
611 10 0 if defined fileno STDOUT
616 0 10 exists $_SELF->{'child_timeout'} ? :
619 0 10 exists $_SELF->{'void_context'} ? :
628 0 10 if ($void_context or $_SELF->{'IGNORE'}) { }
638 0 7 if $timed_out
640 0 7 if ($@) { }
641 0 0 if $@ =~ /^Child exited \(\S+\)$/
644 0 0 unless ($_SELF->{'IGNORE'})
649 0 0 unless ($timed_out or $mngd->{'on_finish'} or $INC{'MCE/Simple.pm'})
654 0 7 if ref($res[0]) =~ /^MCE::(?:Barrier|Semaphore)::_guard/s
656 7 0 @res ? :
7 0 unless $_SELF->{'IGNORE'}
666 0 10 if not $_SELF->{'SIGNALED'} and keys %{$_LIST;}
669 10 0 unless $_tid
672 0 10 if $INC{'threads.pm'} and $_is_MSWin32
675 0 10 exists $_SELF->{'posix_exit'} ? :
677 0 0 if ($posix_exit and not $_SELF->{'SIGNALED'} and not $_is_MSWin32)
679 0 0 if $INC{'POSIX.pm'}
688 9 0 unless exists $_LIST->{$pkg} and $_LIST->{$pkg}->len
691 0 0 if $child->{'IGNORE'}
693 0 0 if ($child->is_running)
694 0 0 if CORE::kill "ZERO", $child->pid
702 0 0 if $count and not $_is_MSWin32
709 0 3 if $MCE::Signal::IPC
715 3 0 if exists $SIG{$name}
717 3 0 unless ($_SELF->{'IGNORE'})
727 0 47 unless $child
731 32 15 length $_[0] ? :
734 0 47 if $child->{'IGNORE'}
739 0 47 if ($code > 100 and not $err)
740 0 0 if $code == 101
741 0 0 if $code == 102
742 0 0 if $code == 106
743 0 0 if $code == 111
744 0 0 if $code == 115
749 8 39 if (my $on_finish = $$_MNGD{$child->{'PKG'}}{'on_finish'})
760 0 0 if $MCE::Signal::IPC
766 0 0 if exists $SIG{$name}
768 0 0 if ($name eq 'HUP') { }
0 0 elsif ($name eq 'INT') { }
0 0 elsif ($name eq 'ABRT') { }
0 0 elsif ($name eq 'SEGV') { }
0 0 elsif ($name eq 'TERM') { }
774 0 0 unless ($_SELF->{'IGNORE'})
790 0 160 if $child->{'REAPED'}
791 4 156 if waitpid $wrk_id, 1
793 4 156 if $self
814 12 0 unless (defined $delay)
815 0 12 $^O =~ /mswin|mingw|msys|cygwin/i ? :
825 0 0 defined $how_long ? :
829 0 0 if (not $delay && defined $lapse) { }
0 0 elsif ($lapse + $delay - $time < 0) { }
853 0 0 $^O eq 'solaris' ? :
12 0 $INC{'POSIX.pm'} ? :
884 23 24 unless (exists $self->[0]{"R" . $wrk_id})
890 41 6 if ($wait_flag)
892 32 9 exists $self->[0]{'R' . $wrk_id} ? :
895 1 17 unless (defined $data)
896 0 1 if waitpid $wrk_id, 1
900 9 8 if $data->[0] eq "R" . $wrk_id
902 0 9 unless (exists $self->[0]{"R" . $wrk_id})
913 0 47 unless defined $result
914 0 47 unless defined $error
922 65 224 if (wantarray)
925 2 17 if substr($data->[0], 0, 1) eq "R"
959 0 47 unless defined(my $off = delete $self->[2]{$key})
965 18 29 if (++$self->[3] > @{$self->[1];} * "0.667")
969 0 46 if defined $k
979 0 55 if exists $self->[0]{$key}
991 1 192 $self->[3] ? :