| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 24 | 4 | $batch_cb->($batch); | |||||||||||||||||||
| 25 | 4 | ▶ | if ($WITH_PM) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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"} // ()
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= ()
| |||||||||||||||||||||
| 29 | }, | ||||||||||||||||||||
| 30 | 4 | ▶ | ( $nproc ? ( forks => $nproc ) : () ), | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 31 | ; | ||||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | else | ||||||||||||||||||||
| 34 | { | ||||||||||||||||||||
| 35 | 0 | $self->serial_run($processed); | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | 4 | return; | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 6 | 1; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||