Branch Coverage

blib/lib/MCE.pm
Criterion Covered Total %
branch 231 760 30.3


line true false branch
27 0 85 if ($^O eq 'MSWin32' and not $INC{'threads.pm'}) { }
0 170 elsif ($INC{'threads.pm'} and not $INC{'threads/shared.pm'}) { }
34 0 85 $INC{'threads.pm'} ? :
35 0 85 $_has_threads ? :
38 85 0 if ($] ge "5.008008" and not $INC{'PDL.pm'})
40 85 0 unless ($@)
43 85 0 if ($_encoder_ver - $_decoder_ver == 0)
50 0 85 if (not defined $_freeze)
112 0 85 $^O eq 'MSWin32' ? :
113 0 85 $^O =~ /mswin|mingw|msys|cygwin/i ? :
120 3 96 unless ref $self
126 62 1 unless ref $self
132 166 42 unless ref $self
163 0 0 if $_arg eq "max_workers"
164 0 0 if $_arg eq "chunk_size"
165 0 0 if $_arg eq "tmp_dir"
166 0 0 if $_arg eq "freeze"
167 0 0 if $_arg eq "thaw"
168 0 0 if $_arg eq "init_relay"
169 0 0 if $_arg eq "use_threads"
171 0 0 if ($_arg eq "export_const" or $_arg eq "const")
172 0 0 if (shift() eq 1)
182 0 0 if ($_arg eq "sereal")
183 0 0 if (shift() eq 0)
194 13 85 if $_imported++
265 0 0 if $INC{'threads.pm'}
269 0 0 if $_is_MSWin32 and $MCE::Signal::KILLED
273 0 0 if $_[0] and $_[0]{'_spawned'} and $_[0]{'_init_pid'} eq "$$.$_tid" and not $MCE::Signal::KILLED
280 65 20 unless defined $MCE
282 0 20 $MCE::MCE->{'_is_thread'} ? :
283 0 20 if exists $MCE::MCE->{'_wuf'} and $MCE::MCE->{'_pid'} eq $_pid
289 37 48 if $INC{'MCE/Flow.pm'}
290 4 81 if $INC{'MCE/Grep.pm'}
291 5 80 if $INC{'MCE/Loop.pm'}
292 4 81 if $INC{'MCE/Map.pm'}
293 12 73 if $INC{'MCE/Step.pm'}
294 10 75 if $INC{'MCE/Stream.pm'}
311 45 0 unless (exists $_plugin_list{$_ext_module})
319 45 0 if (ref $_ext_output_function eq "HASH")
322 545 0 unless exists $_plugin_function{$_p}
326 45 0 if ref $_ext_output_loop_begin eq "CODE"
328 45 0 if ref $_ext_output_loop_end eq "CODE"
330 35 10 if ref $_ext_worker_init eq "CODE"
359 0 0 if ("MCE"->wid == 0 or not $^S)
376 103 216 exists $self{'pkg'} ? :
390 0 319 if exists $_def->{$_pkg}{'INIT_RELAY'}
393 0 319 if exists $_def->{$_pkg}{'USE_THREADS'}
395 85 234 if (exists $self{'_module_instance'})
408 0 1637 unless exists $_valid_fields_new{$_p}
413 0 234 if (defined $self{'use_threads'}) { }
414 0 0 if (not $_has_threads and $self{'use_threads'})
424 0 234 $_has_threads ? :
427 234 0 unless (exists $self{'posix_exit'})
433 0 234 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'}
440 42 192 if (defined $self{'tmp_dir'})
442 0 42 unless -d $self{'tmp_dir'}
444 0 42 unless -w $self{'tmp_dir'}
447 103 131 if (defined $self{'user_tasks'})
449 0 103 unless ref $self{'user_tasks'} eq "ARRAY"
453 0 103 if $self{'user_tasks'}[0]{'init_relay'}
458 0 528 unless exists $_valid_fields_task{$_p}
460 0 159 unless scalar keys %{$_task;}
463 59 100 unless defined $_task->{'max_workers'}
465 159 0 unless defined $_task->{'use_threads'}
486 0 234 if $_is_MSWin32
489 0 234 ref $self{'input_data'} eq 'SCALAR' ? :
492 0 234 $INC{'MCE/Channel.pm'} ? :
234 0 "$$.$_tid" eq $_oid ? :
497 103 131 if (defined $self{'user_tasks'}) { }
505 186 48 $_total_workers < $_data_channels ? :
508 42 192 $_total_workers > $self{'_data_channels'} ? :
509 0 234 if $INC{'MCE/Child.pm'} or $INC{'MCE/Hobo.pm'}
511 234 0 if $MCE::MCE->{'_wid'} == 0
523 0 126 unless ref $self
528 0 126 if $self->{'_wid'}
531 0 126 if $self->{'_spawned'} or exists $self->{'_module_instance'}
533 0 126 if $_is_MSWin32
534 0 126 if $_has_threads and $_is_winenv
536 0 0 if $_tid and $MCE::_GMUTEX
537 0 126 if $_tid
541 0 126 if ($INC{'PDL.pm'})
543 0 0 unless $INC{'PDL/IO/Storable.pm'}
549 0 126 if ($INC{'LWP/UserAgent.pm'} and not $INC{'Net/HTTP.pm'})
554 0 126 if $INC{'MCE/Shared.pm'}
557 0 126 if (defined $self->{'sequence'}) { }
45 81 elsif (defined $self->{'input_data'}) { }
559 0 0 unless $INC{'MCE/Core/Input/Sequence.pm'}
563 45 0 if ($_ref =~ /^(?:ARRAY|HASH|GLOB|FileHandle|IO::)/) { }
0 0 elsif ($_ref eq 'CODE') { }
565 34 11 unless $INC{'MCE/Core/Input/Request.pm'}
569 0 0 unless $INC{'MCE/Core/Input/Iterator.pm'}
573 0 0 unless $INC{'MCE/Core/Input/Handle.pm'}
583 126 0 if (not defined $TOP_HDLR && ($TOP_HDLR->{'_mgr_live'} || $TOP_HDLR->{'_wid'})) { }
0 0 elsif (&refaddr($self) != &refaddr($TOP_HDLR)) { }
585 0 0 if ($_is_MSWin32 and defined $TOP_HDLR and $TOP_HDLR->{'_spawned'})
592 0 0 if $self->{'_data_channels'} > 4
593 0 0 if $self->{'_init_total_workers'} > 4
596 0 0 if ($_is_MSWin32 and $ENV{'PERL_MCE_IPC'} ne "win32")
615 0 126 if ($self->{'_lock_chn'})
632 0 126 if $^O ne "aix" and $^O ne "linux"
635 24 102 if (defined $self->{'init_relay'})
636 9 15 unless ($INC{'MCE/Relay.pm'})
651 0 126 if ($self->{'loop_timeout'} and not $_is_MSWin32)
655 126 0 unless $_is_MSWin32
657 35 91 if (not defined $self->{'user_tasks'}) { }
660 0 35 if (defined $_use_threads and $_use_threads == 1) { }
687 0 114 if (defined $_tsk_use_threads and $_tsk_use_threads == 1) { }
703 0 56 if (defined $_tsk_use_threads and $_tsk_use_threads == 1) { }
739 61 0 if $MCE::MCE->{'_wid'} == 0
741 0 0 if $_tid and $MCE::_GMUTEX
753 0 106 unless ref $self
759 6 100 if (ref $_[0] eq 'HASH' and ref $_[1] eq 'HASH') { }
95 5 elsif (ref $_[0] eq 'HASH') { }
770 106 0 if (defined $_input_data) { }
0 0 elsif (not defined $_params_ref->{'input_data'} || defined $_params_ref->{'sequence'}) { }
786 0 0 unless defined $MCE::MCE->{'init_relay'}
798 0 0 unless ref $self
802 0 0 if ($_fcn eq 'forchunk') { }
0 0 elsif ($_fcn eq 'foreach') { }
0 0 elsif ($_fcn eq 'forseq') { }
803 0 0 unless $INC{'MCE/Candy.pm'}
807 0 0 unless $INC{'MCE/Candy.pm'}
811 0 0 unless $INC{'MCE/Candy.pm'}
817 0 0 if ($_fcn eq 'relay_lock' or $_fcn eq 'relay_recv') { }
0 0 elsif ($_fcn eq 'relay_final') { }
819 0 0 unless defined $MCE::MCE->{'init_relay'}
827 0 0 if ($_fcn eq 'last') { }
0 0 elsif ($_fcn eq 'next') { }
0 0 elsif ($_fcn eq 'pid') { }
0 0 elsif ($_fcn eq 'status') { }
829 0 0 unless $self->{'_wid'}
831 0 0 if defined $self->{'_last_jmp'}
840 0 0 unless $self->{'_wid'}
842 0 0 if defined $self->{'_next_jmp'}
850 0 0 if (defined $self->{'_pid'}) { }
0 0 elsif ($_has_threads and $self->{'use_threads'}) { }
863 0 0 if $self->{'_wid'}
865 0 0 defined $self->{'_wrk_status'} ? :
878 0 0 unless ref $self
883 0 0 if $self->{'_wid'}
896 0 0 defined $_task_id ? :
898 0 0 if defined $_task_id
899 0 0 if defined $_task_id
904 0 0 if (defined $_use_threads and $_use_threads == 1) { }
912 0 0 if (defined $self->{'spawn_delay'} and $self->{'spawn_delay'} > 0) { }
0 0 elsif ($_tid or $_is_MSWin32) { }
928 0 207 unless ref $self
931 0 207 if $self->{'_wid'}
935 81 126 if (ref $_[0] eq 'HASH') { }
936 81 0 defined $_[1] ? :
939 106 20 defined $_[0] ? :
945 154 53 defined $self->{'user_tasks'} ? :
951 0 207 if $self->{'_send_cnt'}
953 91 0 unless (defined $self->{'user_func'} or defined $_params_ref->{'user_func'})
962 187 20 if (defined $_params_ref and ref $_params_ref eq "HASH")
966 154 53 if ($_has_user_tasks)
968 0 154 if $self->{'user_tasks'}[0]{'input_data'}
970 0 154 if $self->{'user_tasks'}[0]{'use_slurpio'}
972 0 154 if $self->{'user_tasks'}[0]{'parallel_io'}
974 0 154 if $self->{'user_tasks'}[0]{'RS'}
976 0 207 if (ref $self->{'input_data'} eq "SCALAR")
977 0 0 if (&refaddr($self->{'input_data'}) != $self->{'_last_sref'})
983 0 207 if $_requires_shutdown
990 126 81 unless $self->{'_spawned'}
991 0 142 unless $self->{'_total_workers'}
996 142 0 if $MCE::MCE->{'_wid'} == 0
1004 0 142 $_has_user_tasks && $self->{'user_tasks'}[0]{'sequence'} ? :
1007 18 124 if (defined $_seq) { }
79 45 elsif (defined $self->{'input_data'}) { }
1009 18 0 ref $_seq eq 'ARRAY' ? :
1012 0 14 if $_has_user_tasks and $self->{'user_tasks'}[0]{'chunk_size'}
1024 18 0 if ($_step > 0) { }
1025 18 0 if $_abort_msg * $_chunk_size * abs($_step) + $_begin <= $_end
1028 0 0 if $_abort_msg * $_chunk_size * abs($_step) + $_end <= $_begin
1037 18 61 if ($_ref eq '') { }
40 21 elsif ($_ref eq 'ARRAY') { }
3 18 elsif ($_ref eq 'HASH') { }
18 0 elsif ($_ref =~ /^(?:GLOB|FileHandle|IO::)/) { }
0 0 elsif ($_ref eq 'CODE') { }
0 0 elsif ($_ref eq 'SCALAR') { }
1044 0 18 if (-s $_input_file == 0)
1045 0 0 if $_auto_shutdown == 1
1053 40 0 if ref $_input_data->[0] eq ""
1057 0 40 if (@{$_input_data;} == 0)
1058 0 0 if $_auto_shutdown == 1
1069 0 3 if (scalar keys %{$_input_data;} == 0)
1070 0 0 if $_auto_shutdown == 1
1094 0 0 if (length ${$self->{'input_data'};} == 0)
1095 0 0 if $_auto_shutdown == 1
1111 0 142 if ($_send_cnt) { }
1133 0 142 $self->{'progress'} ? :
1138 108 34 if ($_has_user_tasks)
1149 201 146 unless $self->{'_state'}[$_i]{'_task_id'}
1156 97 45 if (defined $_first_msg)
1164 282 146 if (not $_has_user_tasks or exists $_task0_wids{$_wid}) { }
1172 0 428 if defined $_submit_delay and $_submit_delay > 0
1182 142 0 if ($self->{'_total_running'} > 0)
1187 0 142 if $_is_MSWin32
1189 142 0 unless ($_send_cnt)
1191 0 142 if ($_is_MSWin32) { }
1210 97 45 if (not $_send_cnt and $_run_mode ne "nodata")
1212 97 0 if defined $self->{'_que_r_sock'}
1218 10 132 if ($_auto_shutdown or $self->{'_total_exited'}) { }
0 132 elsif ($INC{'MCE/Simple.pm'}) { }
0 132 elsif ($^S or $ENV{'PERL_IPERL_RUNNING'}) { }
1225 0 0 unless ($INC{'Mojo/IOLoop.pm'} or $INC{'Win32/GUI.pm'} or $INC{'Gearman/XS.pm'} or $INC{'Gearman/Util.pm'} or $INC{'Tk.pm'} or $INC{'Wx.pm'})
1233 0 0 if ($_t =~ /^(?:[^\n]+\n){1,7}\teval / or $_t =~ /\n\teval [^\n]+\n\t(?:eval|Try)/ or $_t =~ /\n\tMCE::_dispatch\(\) [^\n]+ thread \d+\n$/ or $_tid and not $self->{'use_threads'})
1253 0 0 unless ref $self
1256 0 0 if $self->{'_wid'}
1258 0 0 if $self->{'_total_running'}
1261 0 0 if defined $self->{'input_data'} or defined $self->{'sequence'}
1263 0 0 if defined $self->{'user_tasks'}
1267 0 0 if (ref $_[0] eq 'ARRAY' or ref $_[0] eq 'HASH' or ref $_[0] eq 'PDL') { }
1275 0 0 unless defined $self->{'_send_cnt'}
1280 0 0 unless $self->{'_spawned'}
1283 0 0 if $self->{'_send_cnt'} >= $self->{'_task'}[0]{'_total_workers'}
1302 0 0 if defined $_submit_delay and $_submit_delay > 0
1315 0 61 unless ref $self
1321 0 61 unless $self->{'_spawned'}
1324 0 61 if ($MCE::Signal::KILLED)
1325 0 0 if (defined $self->{'_sess_dir'})
1327 0 0 if -d $_sess_dir
1335 0 61 if $self->{'_send_cnt'}
1345 61 0 if (defined $TOP_HDLR and &refaddr($self) == &refaddr($TOP_HDLR))
1351 0 0 if $_has_threads and $_is_winenv and not $_no_lock
1361 61 0 if (@{$self->{'_pids'};} > 0)
1364 146 61 if $_list->[$i]
1367 0 61 if (@{$self->{'_thrs'};} > 0)
1370 0 0 if $_list->[$i]
1389 0 61 if defined $_sess_dir and -d $_sess_dir
1400 0 61 if ($self->{'loop_timeout'})
1415 0 0 unless ref $self
1417 0 0 unless $self->{'_wid'}
1422 0 0 if $self->{'_task_id'} > 0
1430 0 0 if defined $\
1436 0 0 if $_is_MSWin32
1443 0 0 if $_is_MSWin32
1450 0 0 unless ref $self
1452 0 0 unless $self->{'_wid'}
1461 0 0 if defined $\
1462 0 0 if not $/ or $/ ne $MCE::LF
1464 0 0 if $_lock_chn
1468 0 0 if $_lock_chn
1482 0 0 unless ref $self
1488 0 0 if (defined $_abort_msg)
1491 0 0 if ($_abort_msg > 0)
1496 0 0 if ($self->{'_wid'} > 0)
1503 0 0 if $_lock_chn
1505 0 0 if $_lock_chn
1515 0 0 unless ref $self
1517 0 0 defined $_[0] ? :
1518 0 0 defined $_[1] ? :
1519 0 0 defined $_[2] ? :
1524 0 0 unless $self->{'_wid'}
1533 0 0 unless ($self->{'_exiting'})
1536 0 0 $self->{'_is_thread'} ? :
1540 0 0 if (defined $self->{'init_relay'} and not $self->{'_relayed'} and not $_task_id and exists $self->{'_wuf'} and $self->{'_pid'} eq $_pid)
1543 0 0 unless defined $self->{'_retry_cnt'}
1545 0 0 if (not $_max_retries or ++$self->{'_retry_cnt'} == $_max_retries)
1546 0 0 if $_chunk_id
1551 0 0 if $INC{'MCE/Child.pm'}
1554 0 0 if $INC{'MCE/Hobo.pm'} and "MCE::Hobo"->can("_clear")
1556 0 0 if defined $\
1560 0 0 if $_lock_chn
1562 0 0 if ($self->{'_retry'} and $self->{'_retry'}[2]--) { }
1580 0 0 if $_lock_chn
1589 0 0 unless ref $self
1590 0 0 if defined $self->{'_sess_dir'}
1592 0 0 if ($self->{'_wid'} == 0) { }
1594 0 0 $self->{'_spawned'} ? :
1604 0 0 if defined $\
1605 0 0 if not $/ or $/ ne $MCE::LF
1607 0 0 if $_lock_chn
1610 0 0 if $_lock_chn
1619 31 0 unless ref $self
1620 0 31 if defined $self->{'tmp_dir'}
1622 31 0 if ($self->{'_wid'} == 0) { }
1633 0 0 if defined $\
1634 0 0 if not $/ or $/ ne $MCE::LF
1636 0 0 if $_lock_chn
1639 0 0 if $_lock_chn
1654 130 3 unless ref $self
1655 0 133 caller() eq 'MCE' ? :
1657 0 133 if ref $_[0] eq "CODE"
1659 0 133 unless defined(my $_func = shift())
1662 133 0 if index($_func, ":") < 0
1664 133 0 if ($self->{'_wid'}) { }
1676 357 0 unless ref $self
1679 0 357 unless $self->{'_wid'}
1697 0 0 unless ref $self
1701 0 0 unless $self->{'_wid'}
1703 0 0 unless defined $_[0]
1706 0 0 exists $_sendto_lkup{lc $_to} ? :
1709 0 0 unless (defined $_dest)
1712 0 0 if (ref $_to and defined($_fd = fileno $_to) || defined($_fd = eval { do { $_to->fileno } })) { }
0 0 elsif (&reftype($_to) eq 'GLOB') { }
1715 0 0 if (my $_ob = tied *{$_to;})
1716 0 0 if (ref $_ob eq "IO::TieCombine::Handle")
1717 0 0 if lc $_ob->{'slot_name'} eq "stdout"
1718 0 0 if lc $_ob->{'slot_name'} eq "stderr"
1722 0 0 scalar @_ == 1 ? :
1729 0 0 if (defined $_to and $_to =~ /$_v2_regx/o)
1731 0 0 exists $_sendto_lkup{lc $1} ? :
1735 0 0 if (not defined $_dest or not defined $_value and $_dest == 1 || $_dest == 4)
1752 0 0 if ($_dest == 0)
1753 0 0 if not defined $_[1] or @_ > 2
1769 0 0 unless ref $self
1772 0 0 if (ref $_[0] and defined($_fd = fileno $_[0]) || defined($_fd = eval { do { $_[0]->fileno } })) { }
0 0 elsif (&reftype($_[0]) eq 'GLOB') { }
1775 0 0 if (my $_ob = tied *{$_[0];})
1776 0 0 if (ref $_ob eq "IO::TieCombine::Handle")
1777 0 0 if lc $_ob->{'slot_name'} eq "stdout"
1778 0 0 if lc $_ob->{'slot_name'} eq "stderr"
1788 0 0 scalar @_ ? :
1790 0 0 if $_fd
1791 0 0 if $self->{'_wid'}
1796 0 0 unless ref $self
1799 0 0 if (ref $_[0] and defined($_fd = fileno $_[0]) || defined($_fd = eval { do { $_[0]->fileno } })) { }
0 0 elsif (&reftype($_[0]) eq 'GLOB') { }
1802 0 0 if (my $_ob = tied *{$_[0];})
1803 0 0 if (ref $_ob eq "IO::TieCombine::Handle")
1804 0 0 if lc $_ob->{'slot_name'} eq "stdout"
1805 0 0 if lc $_ob->{'slot_name'} eq "stderr"
1816 0 0 scalar @_ ? :
1818 0 0 if $_fd
1819 0 0 if $self->{'_wid'}
1824 0 0 unless ref $self
1827 0 0 if (ref $_[0] and defined($_fd = fileno $_[0]) || defined($_fd = eval { do { $_[0]->fileno } })) { }
0 0 elsif (&reftype($_[0]) eq 'GLOB') { }
1830 0 0 if (my $_ob = tied *{$_[0];})
1831 0 0 if (ref $_ob eq "IO::TieCombine::Handle")
1832 0 0 if lc $_ob->{'slot_name'} eq "stdout"
1833 0 0 if lc $_ob->{'slot_name'} eq "stderr"
1843 0 0 scalar @_ ? :
1845 0 0 if $_fd
1846 0 0 if $self->{'_wid'}
1858 0 65 exists $self->{'_guard'} && $self->{'_guard'}[0] ? :
1860 0 65 if $_has_guard
1864 65 0 unless $_tid
1867 0 65 if $self->{'use_threads'}
1869 65 0 unless ($_tid)
1873 0 0 if $_[0] eq 'INT' || $_[0] eq 'TERM' and $^O ne "MSWin32"
1880 0 0 if ($self->{'posix_exit'} and not $_has_guard and not $_is_MSWin32)
1882 0 0 if $INC{'POSIX.pm'}
1890 0 126 unless ref $self
1892 91 35 if (defined $self->{'user_tasks'})
1893 91 0 if (defined $self->{'user_tasks'}[0]{'max_workers'})
1902 0 0 unless ref $self
1906 0 0 unless (defined $_sess_dir)
1908 0 0 unless defined $self->{'tmp_dir'}
1910 0 0 $INC{'threads.pm'} ? :
1911 0 0 unless defined $self->{'_mce_tid'}
1916 0 0 if not defined $_tmp_dir or $_tmp_dir eq ""
1918 0 0 unless -d $_tmp_dir
1920 0 0 unless -w $_tmp_dir
1948 0 5 if (length $_chop_str) { }
1969 0 187 if (defined $_params_ref->{'init_relay'} and not defined $self->{'init_relay'})
1973 0 561 if (defined $_params_ref->{$_p})
1980 0 311 unless exists $_params_allowed_args{$_p}
1985 81 106 $self->{'_spawned'} ? :
2004 0 0 if $_is_MSWin32 and defined $self->{'max_retries'} || $INC{'MCE/Child.pm'} || $INC{'MCE/Hobo.pm'}
2010 0 65 $_is_thread ? :
2022 65 0 unless ($self->{'use_threads'})
2024 0 65 if $INC{'Math/Prime/Util.pm'}
2027 0 65 if $INC{'MCE/Hobo.pm'} and "MCE::Hobo"->can("_clear")
2029 0 65 if $INC{'MCE/Child.pm'}
2033 0 65 if (not $self->{'use_threads'} and $INC{'Math/Random.pm'})
2036 0 0 $_cur_seed < 1073741781 ? :
2043 0 65 if (not $self->{'use_threads'} and $INC{'Math/Random/MT/Auto.pm'})
2047 0 0 $_cur_seed < 1073741781 ? :
2070 0 0 unless defined $_thr
2074 0 0 if (defined $_params)
2075 0 0 unless (defined $self->{'_tids'}[$_i])
2086 0 0 if defined $self->{'spawn_delay'} and $self->{'spawn_delay'} > 0
2097 0 277 unless defined $_pid
2100 65 212 if $_pid == 0
2104 0 212 if (defined $_params)
2105 0 0 unless (defined $self->{'_pids'}[$_i])
2113 0 212 if ($self->{'loop_timeout'} and not $_is_MSWin32)
2119 0 212 if defined $self->{'spawn_delay'} and $self->{'spawn_delay'} > 0