| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Permute::Unnamed; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
280843
|
use 5.010001; |
|
|
2
|
|
|
|
|
6
|
|
|
4
|
2
|
|
|
2
|
|
8
|
use strict 'subs', 'vars'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
63
|
|
|
5
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
90
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
7
|
use Exporter qw(import); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
593
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
10
|
|
|
|
|
|
|
our $DATE = '2026-02-21'; # DATE |
|
11
|
|
|
|
|
|
|
our $DIST = 'Permute-Unnamed'; # DIST |
|
12
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT = qw( |
|
15
|
|
|
|
|
|
|
permute_unnamed |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub permute_unnamed { |
|
19
|
2
|
|
|
2
|
1
|
492530
|
my @args = @_; |
|
20
|
2
|
50
|
|
|
|
7
|
die "Please supply a non-empty list of arrayrefs" unless @args; |
|
21
|
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
9
|
for my $i (0 .. $#args) { |
|
23
|
3
|
50
|
|
|
|
9
|
die "arg[$i] cannot contain empty values" unless @{ $args[$i] }; |
|
|
3
|
|
|
|
|
10
|
|
|
24
|
|
|
|
|
|
|
} |
|
25
|
2
|
|
|
|
|
4
|
my @res; |
|
26
|
2
|
|
|
|
|
5
|
my $code = '{ my @j;'; |
|
27
|
2
|
|
|
|
|
4
|
for my $i (0..$#args) { |
|
28
|
3
|
|
|
|
|
9
|
$code .= " local \$main::_j$i;"; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
2
|
|
|
|
|
4
|
for my $i (0..$#args) { |
|
31
|
3
|
|
|
|
|
6
|
$code .= " for \$main::_j$i (0..". $#{$args[$i]} . ") {"; |
|
|
3
|
|
|
|
|
10
|
|
|
32
|
|
|
|
|
|
|
} |
|
33
|
2
|
|
|
|
|
5
|
$code .= " my \$ary = []; for my \$i (0..". $#args . ") { \$ary->[\$i] = \$args[\$i][ \${\"main::_j\$i\"} ]; } push \@res, \$ary;"; |
|
34
|
2
|
|
|
|
|
4
|
for my $i (0..$#args) { |
|
35
|
3
|
|
|
|
|
6
|
$code .= ' }'; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
2
|
|
|
|
|
4
|
$code .= " }"; |
|
38
|
|
|
|
|
|
|
#say $code; |
|
39
|
2
|
50
|
|
|
|
381
|
eval $code; if ($@) { warn "$code\n"; die } ## no critic: BuiltinFunctions::ProhibitStringyEval |
|
|
2
|
|
|
|
|
18
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
40
|
2
|
50
|
|
|
|
25
|
wantarray ? @res : \@res; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
|
44
|
|
|
|
|
|
|
# ABSTRACT: Permute multiple-valued lists |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |