Branch Coverage

blib/lib/MCE/Hobo.pm
Criterion Covered Total %
branch 162 412 39.3


line true false branch
35 15 0 unless ((caller) =~ /^MCE::/)
46 0 15 $^O eq 'solaris' ? :
0 15 $INC{'POSIX.pm'} ? :
59 0 0 if $INC{'threads.pm'}
68 1 9 if ($cpus eq 'auto') { }
6 3 elsif ($cpus =~ /^([0-9.]+)%$/) { }
75 3 7 if not $cpus =~ /^[\d\.]+$/ or $cpus < 1
88 8 14 if defined $_[0] and $_[0] eq "MCE::Hobo"
94 14 8 caller eq 'MCE::Hobo' ? :
95 0 22 ref $_[0] eq 'HASH' ? :
102 7 15 if exists $_LIST->{$pkg}
104 15 7 unless (exists $_LIST->{$pkg})
105 0 0 if $_tid and $MCE::_GMUTEX
106 0 15 if $_tid
109 15 0 if $INC{'MCE/Shared.pm'}
118 0 0 if $_tid and $MCE::_GMUTEX
121 22 0 unless (exists $mngd->{'posix_exit'})
127 0 22 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'}
131 3 19 if (defined $mngd->{'max_workers'})
135 0 22 if ($INC{'LWP/UserAgent.pm'} and not $INC{'Net/HTTP.pm'})
140 5 0 if $mngd->{'on_finish'} and not $INC{'POSIX.pm'} and not $_is_MSWin32
168 70 0 if $_[0] eq "MCE::Hobo"
172 0 70 ref $_[0] eq 'HASH' ? :
174 0 70 if $SIG{'CHLD'} eq "IGNORE"
176 0 70 if not ref $_[0] and ref $_[1] eq "CODE"
178 0 0 if not ref $func and length $func and index($func, ":") < 0
181 0 70 unless (defined $func)
190 0 70 if (my $id = ++$$_DATA{"${pkg}:id"}) >= 2000000000
192 0 70 if ($max_workers or $self->{'IGNORE'})
198 0 0 if $hobo->{'REAPED'}
199 0 0 unless waitpid $wrk_id, 1
204 0 0 if ($max_workers and $list->len >= $max_workers)
212 0 0 if $_tid and $MCE::_GMUTEX
219 70 0 if not $_is_MSWin32 and $] ge "5.010001"
222 70 0 unless $_is_MSWin32
226 0 70 if (not defined $pid) { }
58 12 elsif ($pid) { }
232 10 48 if $mngd->{'on_start'}
242 12 0 if $INC{'MCE/Shared.pm'}
243 12 0 unless $self->{'IGNORE'}
244 0 12 if $killed
254 0 12 if ($INC{'Math/Prime/Util.pm'})
260 0 12 if ($INC{'Math/Random.pm'})
262 0 0 $cur_seed < 1073741781 ? :
269 0 12 if ($INC{'Math/Random/MT/Auto.pm'})
271 0 0 $cur_seed < 1073741781 ? :
282 0 0 if $_tid and $MCE::_GMUTEX
284 0 58 if $killed
286 58 0 $pid ? :
296 0 0 unless ref $_[0] and ref $_[1]
297 0 0 $_[0]{'WRK_ID'} == $_[1]{'WRK_ID'} ? :
301 0 31 unless ref(my $self = $_[0])
302 0 31 unless $self->{'REAPED'}
303 31 0 unless $self->{'ERROR'}
307 0 10 if defined $_[0] and $_[0] eq "MCE::Hobo"
309 10 0 ref $_[0] ? :
312 0 10 if ($wrk_id == $$ and $self->{'MGR_ID'} eq "$$.$_tid") { }
0 10 elsif ($wrk_id == $$) { }
317 0 0 @res ? :
322 0 10 if $self->{'REAPED'}
324 10 0 if (exists $_DATA->{$pkg}) { }
330 0 10 if ($_is_MSWin32) { }
331 0 0 if CORE::kill "ZERO", $wrk_id
333 10 0 if CORE::kill "ZERO", $wrk_id
340 0 7 if ref $_[0]
341 7 0 if defined $_[0] and $_[0] eq "MCE::Hobo"
343 6 1 defined $_[0] ? :
345 3 4 if ($pkg eq 'MCE') { }
3 1 elsif (exists $_LIST->{$pkg}) { }
349 0 3 if $MCE::Signal::KILLED
351 3 0 if (exists $_DELY->{$pkg})
365 0 24 unless ref(my $self = $_[0])
368 0 24 if ($wrk_id == $$) { }
24 0 elsif ($self->{'MGR_ID'} eq "$$.$_tid") { }
372 0 24 if $self->{'REAPED'}
374 24 0 waitpid($wrk_id, 1) == 0 ? :
375 0 0 unless $self->{'REAPED'}
381 0 0 if $self->{'IGNORE'}
383 0 0 if $self->{'REAPED'}
384 0 0 $_DATA->{$pkg}->exists('R' . $wrk_id) ? :
389 0 24 unless ref(my $self = $_[0])
392 0 24 if ($wrk_id == $$) { }
24 0 elsif ($self->{'MGR_ID'} eq "$$.$_tid") { }
396 0 24 if $self->{'REAPED'}
398 24 0 waitpid($wrk_id, 1) == 0 ? :
399 0 0 unless $self->{'REAPED'}
405 0 0 if $self->{'IGNORE'}
407 0 0 if $self->{'REAPED'}
408 0 0 $_DATA->{$pkg}->exists('R' . $wrk_id) ? :
413 0 45 unless ref(my $self = $_[0])
416 0 45 if ($self->{'REAPED'})
417 0 0 unless exists $self->{'RESULT'}
418 0 0 if exists $_LIST->{$pkg}
421 0 0 wantarray ? :
0 0 defined wantarray ? :
425 0 45 if ($wrk_id == $$) { }
45 0 elsif ($self->{'MGR_ID'} eq "$$.$_tid") { }
430 0 45 if ($_tid) { }
444 0 0 if $self->{'IGNORE'}
450 0 45 unless exists $self->{'RESULT'}
453 0 42 wantarray ? :
42 3 defined wantarray ? :
458 0 5 unless ref(my $self = $_[0])
461 0 5 if ($wrk_id == $$)
465 5 0 if ($self->{'MGR_ID'} eq "$$.$_tid")
466 0 5 if $self->{'REAPED'}
467 5 0 if (exists $_DATA->{$pkg}) { }
474 5 0 if CORE::kill "ZERO", $wrk_id
480 0 8 if ref $_[0]
483 8 0 exists $_LIST->{$pkg} ? :
487 0 8 if ref $_[0]
490 8 0 exists $_LIST->{$pkg} ? :
494 0 8 if ref $_[0]
497 0 8 unless my $list = $_LIST->{$pkg}
501 24 0 waitpid($_->{'WRK_ID'}, 1) == 0 ? :
502 0 0 unless $_->{'REAPED'}
510 0 8 if ref $_[0]
513 0 8 unless my $list = $_LIST->{$pkg}
517 24 0 waitpid($_->{'WRK_ID'}, 1) == 0 ? :
518 0 0 unless $_->{'REAPED'}
526 0 17 if ref $_[0]
531 17 0 if $_[0] eq "MCE::Hobo"
533 7 10 if @_
538 0 8 if ref $_[0]
541 8 0 exists $_LIST->{$pkg} ? :
545 31 0 ref $_[0] ? :
549 0 7 unless ref(my $self = $_[0])
550 0 7 unless $self->{'REAPED'}
552 0 7 unless exists $self->{'RESULT'}
553 0 7 wantarray ? :
557 0 0 ref $_[0] ? :
561 0 1 if ref $_[0]
565 0 0 wantarray ? :
0 1 unless exists $_LIST->{$pkg} and $_LIST->{$pkg}->len
569 0 1 wantarray ? :
575 0 4 if ref $_[0]
579 0 4 unless exists $_LIST->{$pkg} and $_LIST->{$pkg}->len
587 0 0 if ref $_[0]
588 0 0 if defined $_[0] and $_[0] eq "MCE::Hobo"
598 0 0 unless $_DELY->{$pkg}
611 0 0 if ($INC{'MCE.pm'}) { }
626 0 12 if $_is_MSWin32
630 12 0 if defined fileno STDERR
631 12 0 if defined fileno STDOUT
636 0 12 exists $_SELF->{'hobo_timeout'} ? :
639 0 12 exists $_SELF->{'void_context'} ? :
648 0 12 if ($void_context or $_SELF->{'IGNORE'}) { }
658 0 9 if $timed_out
660 0 9 if ($@) { }
661 0 0 if $@ =~ /^Hobo exited \(\S+\)$/
664 0 0 unless ($_SELF->{'IGNORE'})
669 0 0 unless ($timed_out or $mngd->{'on_finish'} or $INC{'MCE/Simple.pm'})
674 0 9 if ref($res[0]) =~ /^MCE::(?:Barrier|Semaphore)::_guard/s
676 9 0 @res ? :
9 0 unless $_SELF->{'IGNORE'}
686 0 12 if not $_SELF->{'SIGNALED'} and keys %{$_LIST;}
689 12 0 unless $_tid
692 0 12 if $INC{'threads.pm'} and $_is_MSWin32
695 0 12 exists $_SELF->{'posix_exit'} ? :
697 0 0 if ($posix_exit and not $_SELF->{'SIGNALED'} and not $_is_MSWin32)
699 0 0 if $INC{'POSIX.pm'}
708 10 0 unless exists $_LIST->{$pkg} and $_LIST->{$pkg}->len
711 0 0 if $hobo->{'IGNORE'}
713 0 0 if ($hobo->is_running)
714 0 0 if CORE::kill "ZERO", $hobo->pid
722 0 0 if $count and not $_is_MSWin32
729 0 3 if $MCE::Signal::IPC
735 3 0 if exists $SIG{$name}
737 3 0 unless ($_SELF->{'IGNORE'})
747 0 49 unless $hobo
751 34 15 length $_[0] ? :
754 0 49 if $hobo->{'IGNORE'}
759 0 49 if ($code > 100 and not $err)
760 0 0 if $code == 101
761 0 0 if $code == 102
762 0 0 if $code == 106
763 0 0 if $code == 111
764 0 0 if $code == 115
769 7 42 if (my $on_finish = $$_MNGD{$hobo->{'PKG'}}{'on_finish'})
780 0 0 if $MCE::Signal::IPC
786 0 0 if exists $SIG{$name}
788 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') { }
794 0 0 unless ($_SELF->{'IGNORE'})
809 0 208 if $hobo->{'REAPED'}
810 4 204 if waitpid $wrk_id, 1
812 4 204 if $self
833 15 0 unless (defined $delay)
834 0 15 $^O =~ /mswin|mingw|msys|cygwin/i ? :
844 0 0 defined $how_long ? :
848 0 0 if (not $delay && defined $lapse) { }
0 0 elsif ($lapse + $delay - $time < 0) { }
873 0 15 $^O eq 'solaris' ? :
0 15 $INC{'POSIX.pm'} ? :
888 0 49 if ($wait_flag)
890 0 0 ${$self;}->exists('R' . $wrk_id) ? :
892 0 0 unless (${$self;}->exists("R" . $wrk_id))
893 0 0 if waitpid $wrk_id, 1
921 0 49 unless defined(my $off = delete $self->[2]{$key})
927 21 28 if (++$self->[3] > @{$self->[1];} * "0.667")
931 0 49 if defined $k
941 0 58 if exists $self->[0]{$key}
953 0 241 $self->[3] ? :