line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::RecordStream::Aggregator::CountBy; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = "4.0.23"; |
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
3143
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
138
|
|
6
|
6
|
|
|
6
|
|
27
|
use warnings; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
125
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
346
|
use App::RecordStream::Aggregator::InjectInto::Field; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
116
|
|
9
|
6
|
|
|
6
|
|
27
|
use App::RecordStream::DomainLanguage::Registry; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
110
|
|
10
|
|
|
|
|
|
|
|
11
|
6
|
|
|
6
|
|
23
|
use base qw(App::RecordStream::Aggregator::InjectInto::Field); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
1225
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#sub new -- passed through |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#sub new_from_valuation -- passed through |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub initial |
18
|
|
|
|
|
|
|
{ |
19
|
1
|
|
|
1
|
0
|
3
|
return {}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub combine_field |
23
|
|
|
|
|
|
|
{ |
24
|
9
|
|
|
9
|
0
|
14
|
my $this = shift; |
25
|
9
|
|
|
|
|
14
|
my $cookie = shift; |
26
|
9
|
|
|
|
|
14
|
my $value = shift; |
27
|
|
|
|
|
|
|
|
28
|
9
|
|
|
|
|
19
|
$cookie->{$value}++; |
29
|
9
|
|
|
|
|
31
|
return $cookie; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub squish |
33
|
|
|
|
|
|
|
{ |
34
|
1
|
|
|
1
|
0
|
6
|
my $this = shift; |
35
|
1
|
|
|
|
|
2
|
my $cookie = shift; |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
3
|
return $cookie; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub short_usage |
41
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
0
|
0
|
|
return "counts by unique value for a field"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub long_usage |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
0
|
0
|
|
return <
|
48
|
|
|
|
|
|
|
Usage: cb, |
49
|
|
|
|
|
|
|
Returns a list of uniq values associated with their counts. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Unlike most other aggregators, the value of the field returned will actually |
52
|
|
|
|
|
|
|
be a hash, with keys of uniq fields, and values of the counts. |
53
|
|
|
|
|
|
|
EOF |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub argct |
57
|
|
|
|
|
|
|
{ |
58
|
0
|
|
|
0
|
0
|
|
return 1; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
App::RecordStream::Aggregator->register_implementation('countby', __PACKAGE__); |
62
|
|
|
|
|
|
|
App::RecordStream::Aggregator->register_implementation('cb', __PACKAGE__); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'countby', 'VALUATION'); |
65
|
|
|
|
|
|
|
App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'cb', 'VALUATION'); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |