line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Set::Product::PP; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
19695
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
88
|
|
4
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
101
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
18
|
use Carp qw(croak); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
198
|
|
7
|
4
|
|
|
4
|
|
18
|
use Exporter qw(import); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
123
|
|
8
|
4
|
|
|
4
|
|
18
|
use Scalar::Util qw(reftype); |
|
4
|
|
|
|
|
19
|
|
|
4
|
|
|
|
|
1345
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw(product); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub product (&@) { |
13
|
8
|
|
|
8
|
1
|
3865
|
my ($sub, @in) = @_; |
14
|
|
|
|
|
|
|
|
15
|
8
|
50
|
50
|
|
|
47
|
croak 'Not a subroutine reference' |
16
|
|
|
|
|
|
|
unless 'CODE' eq (reftype($sub) || ''); |
17
|
|
|
|
|
|
|
croak 'Not an array reference' |
18
|
8
|
100
|
100
|
|
|
14
|
if grep { 'ARRAY' ne (reftype($_) || '') } @in; |
|
18
|
|
|
|
|
224
|
|
19
|
7
|
100
|
100
|
|
|
24
|
return if ! @in or grep { ! @$_ } @in; |
|
15
|
|
|
|
|
40
|
|
20
|
|
|
|
|
|
|
|
21
|
5
|
|
|
|
|
56
|
my @out = map { $in[$_]->[0] } 0 .. $#in; |
|
12
|
|
|
|
|
22
|
|
22
|
5
|
|
|
|
|
12
|
my @idx = (0) x @in; |
23
|
|
|
|
|
|
|
|
24
|
5
|
|
|
|
|
14
|
for (my $i = 0; $i >= 0; ) { |
25
|
22
|
|
|
|
|
54
|
$sub->(@out); |
26
|
22
|
|
|
|
|
136
|
for ($i=$#in; $i >= 0; $i--) { |
27
|
32
|
|
|
|
|
35
|
$idx[$i]++; |
28
|
32
|
100
|
|
|
|
33
|
if ($idx[$i] > $#{$in[$i]}) { |
|
32
|
|
|
|
|
58
|
|
29
|
15
|
|
|
|
|
18
|
$idx[$i] = 0; |
30
|
15
|
|
|
|
|
132
|
$out[$i] = $in[$i]->[0]; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else { |
33
|
17
|
|
|
|
|
22
|
$out[$i] = $in[$i]->[$idx[$i]]; |
34
|
17
|
|
|
|
|
33
|
last; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |