| 1 | package Parallel::Map::Segmented; | ||||||||||||||||||||
| 2 | 6 | $Parallel::Map::Segmented::VERSION = '0.2.2'; | |||||||||||||||||||
| 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 5.014; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 6 | ▶ | use parent 'Parallel::ForkManager::Segmented::Base'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 6 | ▶ | use Parallel::Map qw/ pmap_void /; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | sub run | ||||||||||||||||||||
| 12 | { | ||||||||||||||||||||
| 13 | 5 | ▶ | my ( $self, $args ) = @_; | ||||||||||||||||||
|
Subroutine
run: called CC=6 SCAR=20.1
Pod
documented
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 5 | my $processed = $self->process_args($args); | |||||||||||||||||||
| 16 | 5 | ▶ | return if not $processed; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 17 | my ( $WITH_PM, $batch_cb, $batch_size, $nproc, $stream_cb, ) = | ||||||||||||||||||||
| 18 | 4 | @{$processed}{qw/ WITH_PM batch_cb batch_size nproc stream_cb /}; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 4 | my $batch = $stream_cb->( { size => 1 } )->{items}; | |||||||||||||||||||
| 21 | 4 | ▶ | return if not defined $batch; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 22 | 4 | $batch_cb->($batch); | |||||||||||||||||||
| 23 | 4 | ▶ | if ($WITH_PM) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 24 | { | ||||||||||||||||||||
| 25 | 0 | ▶ | pmap_void sub { $batch_cb->(shift); Future->done; }, generate => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 26 | 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"} // ()
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= ()
| |||||||||||||||||||||
| 27 | }, | ||||||||||||||||||||
| 28 | 4 | ▶ | ( $nproc ? ( forks => $nproc ) : () ), | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | ; | ||||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | else | ||||||||||||||||||||
| 32 | { | ||||||||||||||||||||
| 33 | 0 | ▶ | while ( | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 34 | defined( | ||||||||||||||||||||
| 35 | $batch = $stream_cb->( { size => $batch_size } )->{items} | ||||||||||||||||||||
| 36 | ) | ||||||||||||||||||||
| 37 | ) | ||||||||||||||||||||
| 38 | { | ||||||||||||||||||||
| 39 | 0 | $batch_cb->($batch); | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | 4 | return; | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 6 | 1; | |||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | __END__ | ||||||||||||||||||||