| 1 | package List::MapBruteBatch; | ||||||||||||||
| 2 | 2 | ▶ | BEGIN { $List::MapBruteBatch::VERSION = '0.02'; } | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 2 | ▶ | use Exporter 'import'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | |||||||||||||||
| 7 | 2 | our @EXPORT_OK = 'map_brute_batch'; | |||||||||||||
| 8 | |||||||||||||||
| 9 | 37 | ▶ | sub map_brute_batch { | ||||||||||||
|
Subroutine
map_brute_batch: called CC=5 SCAR=16.6
Pod
undocumented
| |||||||||||||||
| 10 | 37 | my ($cb, $items, $cb_success, $cb_failure) = @_; | |||||||||||||
| 11 | |||||||||||||||
| 12 | 37 | ▶ | if ($cb->($items)) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 13 | 16 | ▶ | return $cb_success->($items) if $cb_success; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 14 | 0 | return; | |||||||||||||
| 15 | } elsif (@$items > 1) { | ||||||||||||||
| 16 | 18 | my $i = @$items; | |||||||||||||
| 17 | 18 | my @a = @$items[0 .. ($i / 2)-1]; | |||||||||||||
| 18 | 18 | my @b = @$items[$i / 2 .. ($i - 1)]; | |||||||||||||
| 19 | |||||||||||||||
| 20 | return ( | ||||||||||||||
| 21 | 18 | map_brute_batch($cb, \@a, $cb_success, $cb_failure), | |||||||||||||
| 22 | map_brute_batch($cb, \@b, $cb_success, $cb_failure), | ||||||||||||||
| 23 | ); | ||||||||||||||
| 24 | } else { | ||||||||||||||
| 25 | 3 | ▶ | return $cb_failure->($items) if $cb_failure; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 26 | 0 | return; | |||||||||||||
| 27 | } | ||||||||||||||
| 28 | |||||||||||||||
| 29 | } | ||||||||||||||
| 30 | |||||||||||||||
| 31 | 2 | 1; | |||||||||||||
| 32 | |||||||||||||||
| 33 | __END__ | ||||||||||||||