line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::PowerSet::Hash; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Data::PowerSet::Hash::VERSION = '0.04'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: Power sets of hashes |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
136243
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
49
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
9
|
1
|
|
|
1
|
|
12981
|
use parent 'Exporter'; |
|
1
|
|
|
|
|
827
|
|
|
1
|
|
|
|
|
7
|
|
10
|
1
|
|
|
1
|
|
40285
|
use Data::PowerSet 'powerset'; |
|
1
|
|
|
|
|
2512
|
|
|
1
|
|
|
|
|
563
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT_OK = 'hash_powerset'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub hash_powerset { |
15
|
4
|
|
|
4
|
1
|
1285
|
my %hash = @_; |
16
|
4
|
|
|
|
|
11
|
my @pset = (); |
17
|
4
|
|
|
|
|
20
|
my $pset = powerset( keys %hash ); |
18
|
|
|
|
|
|
|
|
19
|
4
|
|
|
|
|
152
|
foreach my $combo ( @{$pset} ) { |
|
4
|
|
|
|
|
9
|
|
20
|
8
|
|
|
|
|
35
|
push @pset, { |
21
|
8
|
|
|
|
|
13
|
map +( $_ => $hash{$_} ), @{$combo} |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
4
|
|
|
|
|
29
|
return @pset; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |