line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
81148
|
use 5.008; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
117
|
|
2
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
96
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
168
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Data::Inherited; |
6
|
|
|
|
|
|
|
our $VERSION = '1.100860'; |
7
|
|
|
|
|
|
|
# ABSTRACT: Hierarchy-wide accumulation of list and hash results |
8
|
3
|
|
|
3
|
|
2667
|
use NEXT 0.64; |
|
3
|
|
|
|
|
16970
|
|
|
3
|
|
|
|
|
1349
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub every_list { |
11
|
5
|
|
|
5
|
1
|
2484
|
my ($self, $list_name, $override_cache) = @_; |
12
|
5
|
|
|
|
|
7
|
our %every_cache; |
13
|
5
|
|
33
|
|
|
23
|
my $pkg = ref $self || $self; # can also be called as a class method |
14
|
5
|
|
|
|
|
7
|
my $list; |
15
|
5
|
50
|
|
|
|
22
|
unless ($list = $override_cache ? undef : $every_cache{$list_name}{$pkg}) { |
|
|
50
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
7
|
$list = []; |
18
|
5
|
|
|
|
|
11
|
my $call = "EVERY::LAST::$list_name"; |
19
|
5
|
|
|
|
|
38
|
my @every_list = $self->$call; |
20
|
5
|
50
|
|
|
|
599
|
return unless scalar @every_list; |
21
|
5
|
|
|
|
|
18
|
while (my ($class, $class_list) = splice(@every_list, 0, 2)) { |
22
|
12
|
|
|
|
|
42
|
push @$list => @$class_list; |
23
|
|
|
|
|
|
|
} |
24
|
5
|
|
|
|
|
13
|
$every_cache{$list_name}{$pkg} = $list; |
25
|
|
|
|
|
|
|
} |
26
|
5
|
50
|
|
|
|
21
|
wantarray ? @$list : $list; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub every_hash { |
30
|
7
|
|
|
7
|
1
|
6947
|
my ($self, $hash_name, $override_cache) = @_; |
31
|
7
|
|
|
|
|
13
|
our %every_cache; |
32
|
7
|
|
33
|
|
|
25
|
my $pkg = ref $self || $self; # can also be called as a class method |
33
|
7
|
|
|
|
|
8
|
my $hash; |
34
|
7
|
100
|
|
|
|
26
|
unless ($hash = $override_cache ? undef : $every_cache{$hash_name}{$pkg}) { |
|
|
100
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
4
|
|
|
|
|
7
|
$hash = {}; |
37
|
4
|
|
|
|
|
9
|
my $call = "EVERY::LAST::$hash_name"; |
38
|
4
|
|
|
|
|
41
|
my @every_hash = $self->$call; |
39
|
4
|
|
|
|
|
2574
|
while (my ($class, $class_hash) = splice(@every_hash, 0, 2)) { |
40
|
7
|
|
|
|
|
54
|
%$hash = (%$hash, @$class_hash); |
41
|
|
|
|
|
|
|
} |
42
|
4
|
|
|
|
|
11
|
$every_cache{$hash_name}{$pkg} = $hash; |
43
|
|
|
|
|
|
|
} |
44
|
7
|
50
|
|
|
|
42
|
wantarray ? %$hash : $hash; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub flush_every_cache_by_key { |
48
|
0
|
|
|
0
|
1
|
|
my ($self, $key) = @_; |
49
|
0
|
|
|
|
|
|
our %every_cache; |
50
|
0
|
|
|
|
|
|
delete $every_cache{$key}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |