Branch Coverage

blib/lib/MCE/Child.pm
Criterion Covered Total %
branch 178 422 42.1


line true false branch
33 9 0 unless ((caller) =~ /^MCE::/)
44 0 9 $^O eq 'solaris' ? :
0 9 $INC{'POSIX.pm'} ? :
55 0 0 if $INC{'threads.pm'}
64 1 9 if ($cpus eq 'auto') { }
6 3 elsif ($cpus =~ /^([0-9.]+)%$/) { }
71 3 7 if not $cpus =~ /^[\d\.]+$/ or $cpus < 1
86 0 0 if (defined $pkg and $id eq "${$}.$_tid")
95 8 8 if defined $_[0] and $_[0] eq __PACKAGE__
101 0 16 ref $_[0] eq 'HASH' ? :
110 7 9 if defined $_LIST->{$pkg}
112 9 7 unless (defined $_LIST->{$pkg})
113 0 0 if $_tid and $MCE::_GMUTEX
114 0 9 if $_tid
117 0 9 if $INC{'MCE/Shared.pm'}
127 0 0 if $_tid and $MCE::_GMUTEX
130 16 0 unless (exists $mngd->{'posix_exit'})
136 0 16 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'}
140 3 13 if (defined $mngd->{'max_workers'})
144 0 16 if ($INC{'LWP/UserAgent.pm'} and not $INC{'Net/HTTP.pm'})
149 5 0 if $mngd->{'on_finish'} and not $INC{'POSIX.pm'} and not $_is_MSWin32
152 0 16 defined wantarray ? :
181 50 0 if $_[0] eq __PACKAGE__
185 0 50 ref $_[0] eq 'HASH' ? :
187 0 50 if $SIG{'CHLD'} eq "IGNORE"
189 0 50 if not ref $_[0] and ref $_[1] eq "CODE"
191 0 0 if not ref $func and length $func and index($func, ":") == -1
194 0 50 unless (defined $func)
203 0 50 if (my $id = ++$$_DATA{"${pkg}:id"}) >= 2000000000
211 2 0 unless ($child->{'REAPED'})
221 0 50 if $max_workers and $list->len >= $max_workers
225 0 0 if $_tid and $MCE::_GMUTEX
232 50 0 if not $_is_MSWin32 and $] ge "5.010001"
235 50 0 unless $_is_MSWin32
239 0 50 if (not defined $pid) { }
43 7 elsif ($pid) { }
245 10 33 if $mngd->{'on_start'}
255 0 7 if $INC{'MCE/Shared.pm'}
256 7 0 unless $self->{'IGNORE'}
257 0 7 if $killed
259 7 0 if $INC{'MCE/Child.pm'}
260 0 7 if $INC{'MCE/Hobo.pm'}
272 0 7 if $INC{'PDL.pm'} and "PDL"->can("srand")
273 0 7 if $INC{'PDL.pm'} and "PDL"->can("srandom")
274 0 7 if $INC{'Math/Prime/Util.pm'}
277 0 7 if ($INC{'Math/Random.pm'})
279 0 0 $cur_seed < 1073741781 ? :
286 0 7 if ($INC{'Math/Random/MT/Auto.pm'})
288 0 0 $cur_seed < 1073741781 ? :
299 0 0 if $_tid and $MCE::_GMUTEX
301 0 43 if $killed
303 43 0 $pid ? :
313 0 0 unless ref $_[0] and ref $_[1]
314 0 0 $_[0]{'WRK_ID'} == $_[1]{'WRK_ID'} ? :
318 0 22 unless ref(my $self = $_[0])
319 0 22 unless $self->{'REAPED'}
320 22 0 unless $self->{'ERROR'}
324 0 10 if defined $_[0] and $_[0] eq __PACKAGE__
326 10 0 ref $_[0] ? :
329 0 10 if ($wrk_id == $$ and $self->{'MGR_ID'} eq "${$}.$_tid") { }
0 10 elsif ($wrk_id == $$) { }
335 0 0 @res ? :
0 0 unless $self->{'IGNORE'}
340 0 10 if $self->{'REAPED'}
342 10 0 if (defined $_DATA->{$pkg}) { }
348 0 10 if ($_is_MSWin32) { }
349 0 0 if CORE::kill "ZERO", $wrk_id
351 10 0 if CORE::kill "ZERO", $wrk_id
358 0 19 if ref $_[0]
359 19 0 if defined $_[0] and $_[0] eq __PACKAGE__
361 18 1 defined $_[0] ? :
363 17 2 if ($pkg eq 'MCE') { }
2 0 elsif (defined $_LIST->{$pkg}) { }
367 0 2 if $MCE::Signal::KILLED
369 2 0 if (exists $_DELY->{$pkg})
383 0 15 unless ref(my $self = $_[0])
386 0 15 if ($wrk_id == $$) { }
15 0 elsif ($self->{'MGR_ID'} eq "${$}.$_tid") { }
390 0 15 if $self->{'REAPED'}
392 15 0 if (waitpid($wrk_id, 1) == 0) { }
393 0 0 unless $self->{'REAPED'}
404 0 15 unless ref(my $self = $_[0])
407 0 15 if ($wrk_id == $$) { }
15 0 elsif ($self->{'MGR_ID'} eq "${$}.$_tid") { }
411 0 15 if $self->{'REAPED'}
413 15 0 if (waitpid($wrk_id, 1) == 0) { }
414 0 0 unless $self->{'REAPED'}
425 0 32 unless ref(my $self = $_[0])
428 0 32 if ($self->{'REAPED'})
429 0 0 unless exists $self->{'RESULT'}
430 0 0 if defined $_LIST->{$pkg}
433 0 0 wantarray ? :
0 0 defined wantarray ? :
437 0 32 if ($wrk_id == $$) { }
32 0 elsif ($self->{'MGR_ID'} eq "${$}.$_tid") { }
451 0 32 unless exists $self->{'RESULT'}
454 0 30 wantarray ? :
30 2 defined wantarray ? :
459 0 5 unless ref(my $self = $_[0])
462 0 5 if ($wrk_id == $$)
466 5 0 if ($self->{'MGR_ID'} eq "${$}.$_tid")
467 0 5 if $self->{'REAPED'}
468 5 0 if (defined $_DATA->{$pkg}) { }
475 5 0 if CORE::kill "ZERO", $wrk_id
481 0 5 if ref $_[0]
484 5 0 defined $_LIST->{$pkg} ? :
488 0 5 if ref $_[0]
491 5 0 defined $_LIST->{$pkg} ? :
495 0 5 if ref $_[0]
498 0 5 unless my $list = $_LIST->{$pkg}
502 15 0 if (waitpid($_->{'WRK_ID'}, 1) == 0) { }
503 0 0 unless $_->{'REAPED'}
511 0 5 if ref $_[0]
514 0 5 unless my $list = $_LIST->{$pkg}
518 15 0 if (waitpid($_->{'WRK_ID'}, 1) == 0) { }
519 0 0 unless $_->{'REAPED'}
527 0 17 if ref $_[0]
532 17 0 if $_[0] eq __PACKAGE__
534 7 10 if @_
539 0 5 if ref $_[0]
542 5 0 defined $_LIST->{$pkg} ? :
546 22 0 if (ref $_[0]) { }
550 0 7 unless ref(my $self = $_[0])
551 0 7 unless $self->{'REAPED'}
553 0 7 unless exists $self->{'RESULT'}
554 0 7 if (wantarray) { }
558 0 0 if ref $_[0]
559 0 0 exists $_SELF->{'PKG'} ? :
565 0 0 ref $_[0] ? :
569 0 1 if ref $_[0]
573 0 0 wantarray ? :
0 1 unless defined $_LIST->{$pkg} and $_LIST->{$pkg}->len
577 0 1 wantarray ? :
583 0 4 if ref $_[0]
587 0 4 unless defined $_LIST->{$pkg} and $_LIST->{$pkg}->len
595 0 0 if ref $_[0]
596 0 0 if defined $_[0] and $_[0] eq __PACKAGE__
606 0 0 unless $_DELY->{$pkg}
619 0 0 if ($INC{'MCE.pm'}) { }
634 0 7 if $_is_MSWin32
638 7 0 if defined fileno STDERR
639 7 0 if defined fileno STDOUT
644 0 7 exists $_SELF->{'child_timeout'} ? :
647 0 7 exists $_SELF->{'void_context'} ? :
656 0 7 if ($void_context or $_SELF->{'IGNORE'}) { }
666 0 7 if $timed_out
668 0 7 if ($@) { }
669 0 0 if $@ =~ /^Child exited \(\S+\)$/
672 0 0 unless ($_SELF->{'IGNORE'})
677 0 0 unless ($timed_out or $mngd->{'on_finish'} or $INC{'MCE/Simple.pm'})
682 0 7 if ref($res[0]) =~ /^MCE::(?:Barrier|Semaphore)::_guard/s
684 7 0 @res ? :
7 0 unless $_SELF->{'IGNORE'}
694 0 7 if not $_SELF->{'SIGNALED'} and keys %{$_LIST;}
697 7 0 unless $_tid
700 0 7 if $INC{'threads.pm'} and $_is_MSWin32
701 0 7 if $_SELF->{'SIGNALED'} and not $_is_MSWin32
704 0 7 exists $_SELF->{'posix_exit'} ? :
706 0 7 if ($posix_exit and not $_is_MSWin32)
708 0 0 if $INC{'POSIX.pm'}
717 9 0 unless defined $_LIST->{$pkg} and $_LIST->{$pkg}->len
720 0 0 if $child->{'IGNORE'}
722 0 0 if ($child->is_running)
723 0 0 if CORE::kill "ZERO", $child->pid
731 0 0 if $count and not $_is_MSWin32
738 0 0 if $MCE::Signal::IPC
744 0 0 if exists $SIG{$name}
746 0 0 unless ($_SELF->{'IGNORE'})
756 0 38 unless $child and defined $child->{'PKG'}
760 23 15 length $_[0] ? :
763 0 38 if $child->{'IGNORE'}
768 0 38 if ($code > 100 and not $err)
769 0 0 if $code == 101
770 0 0 if $code == 102
771 0 0 if $code == 106
772 0 0 if $code == 111
773 0 0 if $code == 115
778 8 30 if (my $on_finish = $$_MNGD{$child->{'PKG'}}{'on_finish'})
789 0 0 if $MCE::Signal::IPC
795 0 0 if exists $SIG{$name}
797 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') { }
803 0 0 unless ($_SELF->{'IGNORE'})
819 0 768 if $child->{'REAPED'}
820 4 764 if waitpid $wrk_id, 1
822 4 764 if $self
843 9 0 unless (defined $delay)
844 0 9 $^O =~ /mswin|mingw|msys|cygwin/i ? :
854 0 0 defined $how_long ? :
858 0 0 if (not $delay && defined $lapse) { }
0 0 elsif ($lapse + $delay - $time < 0) { }
882 0 9 $^O eq 'solaris' ? :
0 9 $INC{'POSIX.pm'} ? :
909 2 13 if substr($key, 0, 1) eq "R"
917 17 21 unless exists $self->[0]{'R' . $wrk_id}
919 32 6 if ($wait_flag)
921 26 6 if (exists $self->[0]{'R' . $wrk_id}) { }
924 6 6 unless (defined $data)
925 0 6 if waitpid $wrk_id, 1
929 6 0 if $data->[0] eq 'R' . $wrk_id
931 0 6 unless exists $self->[0]{'R' . $wrk_id}
938 0 38 unless defined $result
939 0 38 unless defined $error
975 0 38 unless defined(my $off = delete $self->[2]{$key})
981 15 23 if (++$self->[3] > @{$self->[1];} * "0.667")
985 0 37 if defined $k
995 0 43 if exists $self->[0]{$key}
1007 1 788 $self->[3] ? :