line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::RecordStream::Aggregator::Internal::ForField2; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
4667
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
117
|
|
4
|
5
|
|
|
5
|
|
21
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
125
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
22
|
use App::RecordStream::Aggregator::Aggregation; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
113
|
|
7
|
5
|
|
|
5
|
|
22
|
use App::RecordStream::DomainLanguage::Registry; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
120
|
|
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
22
|
use base 'App::RecordStream::Aggregator::Aggregation'; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
2029
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new |
12
|
|
|
|
|
|
|
{ |
13
|
12
|
|
|
12
|
0
|
20
|
my $class = shift; |
14
|
12
|
|
|
|
|
17
|
my $regex1 = shift; |
15
|
12
|
|
|
|
|
14
|
my $regex2 = shift; |
16
|
12
|
|
|
|
|
44
|
my $snippet = shift; |
17
|
|
|
|
|
|
|
|
18
|
12
|
|
|
|
|
40
|
my $this = |
19
|
|
|
|
|
|
|
{ |
20
|
|
|
|
|
|
|
'REGEX1' => $regex1, |
21
|
|
|
|
|
|
|
'REGEX2' => $regex2, |
22
|
|
|
|
|
|
|
'SNIPPET' => $snippet, |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
12
|
|
|
|
|
20
|
bless $this, $class; |
26
|
|
|
|
|
|
|
|
27
|
12
|
|
|
|
|
28
|
return $this; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub initial |
31
|
|
|
|
|
|
|
{ |
32
|
4
|
|
|
4
|
0
|
60
|
return {}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub combine |
36
|
|
|
|
|
|
|
{ |
37
|
40
|
|
|
40
|
0
|
50
|
my $this = shift; |
38
|
40
|
|
|
|
|
48
|
my $cookie = shift; |
39
|
40
|
|
|
|
|
52
|
my $record = shift; |
40
|
|
|
|
|
|
|
|
41
|
40
|
|
|
|
|
52
|
my @field1; |
42
|
|
|
|
|
|
|
my @field2; |
43
|
40
|
|
|
|
|
97
|
for my $field (keys(%$record)) |
44
|
|
|
|
|
|
|
{ |
45
|
132
|
100
|
|
|
|
382
|
push @field1, $field if($field =~ $this->{'REGEX1'}); |
46
|
132
|
100
|
|
|
|
381
|
push @field2, $field if($field =~ $this->{'REGEX2'}); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
40
|
|
|
|
|
70
|
for my $field1 (@field1) |
50
|
|
|
|
|
|
|
{ |
51
|
64
|
|
|
|
|
88
|
for my $field2 (@field2) |
52
|
|
|
|
|
|
|
{ |
53
|
112
|
|
|
|
|
183
|
my $fieldc = "$field1,$field2"; |
54
|
|
|
|
|
|
|
|
55
|
112
|
100
|
|
|
|
190
|
if(!exists($cookie->{$fieldc})) |
56
|
|
|
|
|
|
|
{ |
57
|
16
|
|
|
|
|
58
|
my $agg = $this->{'SNIPPET'}->evaluate_as('AGGREGATOR', {'$f1' => $field1, '$f2' => $field2}); |
58
|
16
|
|
|
|
|
63
|
$cookie->{$fieldc} = [$agg, $agg->initial()]; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
112
|
|
|
|
|
152
|
my ($agg, $sub_cookie) = @{$cookie->{$fieldc}}; |
|
112
|
|
|
|
|
193
|
|
62
|
|
|
|
|
|
|
|
63
|
112
|
|
|
|
|
228
|
$sub_cookie = $agg->combine($sub_cookie, $record); |
64
|
|
|
|
|
|
|
|
65
|
112
|
|
|
|
|
226
|
$cookie->{$fieldc}->[1] = $sub_cookie; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
40
|
|
|
|
|
94
|
return $cookie; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub squish |
73
|
|
|
|
|
|
|
{ |
74
|
4
|
|
|
4
|
0
|
17
|
my $this = shift; |
75
|
4
|
|
|
|
|
6
|
my $cookie = shift; |
76
|
|
|
|
|
|
|
|
77
|
4
|
|
|
|
|
11
|
for my $fieldc (keys(%$cookie)) |
78
|
|
|
|
|
|
|
{ |
79
|
16
|
|
|
|
|
23
|
my ($agg, $sub_cookie) = @{$cookie->{$fieldc}}; |
|
16
|
|
|
|
|
27
|
|
80
|
16
|
|
|
|
|
37
|
$cookie->{$fieldc} = $agg->squish($sub_cookie); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
4
|
|
|
|
|
9
|
return $cookie; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new', 'for_field', 'SCALAR', 'SCALAR', 'SNIPPET'); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |