line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package List::MapBruteBatch; |
2
|
1
|
|
|
1
|
|
12746
|
BEGIN { $List::MapBruteBatch::VERSION = '0.01'; } |
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
15
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
3
|
use Exporter 'import'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
132
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = 'map_brute_batch'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub map_brute_batch { |
10
|
41
|
|
|
41
|
0
|
128
|
my ($cb, $items, $cb_success, $cb_failure) = @_; |
11
|
|
|
|
|
|
|
|
12
|
41
|
100
|
|
|
|
39
|
if ($cb->($items)) { |
|
|
100
|
|
|
|
|
|
13
|
16
|
50
|
|
|
|
100
|
return $cb_success->($items) if $cb_success; |
14
|
0
|
|
|
|
|
0
|
return; |
15
|
|
|
|
|
|
|
} elsif (@$items > 1) { |
16
|
20
|
|
|
|
|
170
|
my $i = @$items; |
17
|
20
|
|
|
|
|
39
|
my @a = @$items[0 .. ($i / 2)-1]; |
18
|
20
|
|
|
|
|
41
|
my @b = @$items[$i / 2 .. ($i - 1)]; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return ( |
21
|
20
|
|
|
|
|
27
|
map_brute_batch($cb, \@a, $cb_success, $cb_failure), |
22
|
|
|
|
|
|
|
map_brute_batch($cb, \@b, $cb_success, $cb_failure), |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
} else { |
25
|
5
|
50
|
|
|
|
29
|
return $cb_failure->($items) if $cb_failure; |
26
|
0
|
|
|
|
|
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |