blib/lib/Parallel/Map/Segmented.pm

filter: Statementstmt 91.8% 34 / 37 Branchbran 62.5% 5 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 90.0% 9 / 10 Podpod 100% 1 / 1 totaltotal 83.6% 51 / 61 CC 6 SCAR 9.9
CC
6
Cov
85%
run
5.5
__ANON__
2.1
__ANON__
2.0
CRAP 2.7
« Build ↑ Summary
1 package Parallel::Map::Segmented;
2 6 $Parallel::Map::Segmented::VERSION = '0.4.0';
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 6 ▶use Parallel::ForkManager::Segmented::Base v0.4.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use parent 'Parallel::ForkManager::Segmented::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 6 ▶use Parallel::Map qw/ pmap_void /;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub run
14 {
15 5 ▶ my ( $self, $args ) = @_;
Subroutine run: called CC=5 SCAR=17.0
Pod documented
16  
17 5 my $processed = $self->process_args($args);
18 5 ▶ return if not $processed;
Branch: 1 branch
BranchTrueFalseTotal
unless $processed 1 4 5
19 my ( $WITH_PM, $batch_cb, $batch_size, $nproc, $stream_cb, ) =
20 4 @{$processed}{qw/ WITH_PM batch_cb batch_size nproc stream_cb /};
21  
22 4 my $batch = $stream_cb->( { size => 1 } )->{items};
23 4 ▶ return if not defined $batch;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $batch 0 4 4
24 4 $batch_cb->($batch);
25 4 ▶ if ($WITH_PM)
Branch: 1 branch
BranchTrueFalseTotal
if ($WITH_PM) { } 4 0 4
26 {
27 0 ▶ pmap_void sub { $batch_cb->(shift); Future->done; }, generate => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
28 28 ▶ return $stream_cb->( { size => $batch_size } )->{items} // ();
Subroutine __ANON__: called CC=2 SCAR=7.2
Condition66%2/3
&$stream_cb({"size", $batch_size})->{"items"} // ()
l!l&&r!l&&!r
16120
MC/DC0%0/2
&$stream_cb({"size", $batch_size})->{"items"} // ()
&$stream_cb({"size", $batch_size})->{"items"} ()
Truth table66%2/3
A // B
A= &$stream_cb({"size", $batch_size})->{"items"}B= ()
ABresult
1X1
011
000
29 },
30 4 ▶ ( $nproc ? ( forks => $nproc ) : () ),
Branch: 1 branch
BranchTrueFalseTotal
$nproc ? : 4 0 4
31 ;
32 }
33 else
34 {
35 0 $self->serial_run($processed);
36 }
37 4 return;
38 }
39  
40 6 1;
41  
42 __END__
« Build ↑ Summary