« blib/lib/App/RecordStream/Clumper/Key.pm
↑ Summary
blib/lib/App/RecordStream/Aggregator/UniqConcatenate.pm »
| 1 | package App::RecordStream::Aggregator::UniqArray; | ||
| 2 | |||
| 3 | 7 | our $VERSION = "4.0.23"; | |
| 4 | |||
| 5 | 7 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 7 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 7 | ▶ | use App::RecordStream::Aggregator; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 7 | ▶ | use App::RecordStream::DomainLanguage::Registry; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 7 | ▶ | use App::RecordStream::DomainLanguage::Valuation::KeySpec; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 7 | ▶ | use base qw(App::RecordStream::Aggregator::Aggregation); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | sub new { | ||
| 15 | 1 | ▶ | my $class = shift; |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 16 | 1 | my $field = shift; | |
| 17 | |||
| 18 | 1 | return new_from_valuation($class, App::RecordStream::DomainLanguage::Valuation::KeySpec->new($field)); | |
| 19 | } | ||
| 20 | |||
| 21 | sub new_from_valuation { | ||
| 22 | 10 | ▶ | my $class = shift; |
|
Subroutine
new_from_valuation: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 23 | 10 | my $valuation = shift; | |
| 24 | |||
| 25 | 10 | my $this = | |
| 26 | { | ||
| 27 | 'valuation' => $valuation, | ||
| 28 | }; | ||
| 29 | |||
| 30 | 10 | bless $this, $class; | |
| 31 | |||
| 32 | 10 | return $this; | |
| 33 | } | ||
| 34 | |||
| 35 | sub squish { | ||
| 36 | 4 | ▶ | my ($this, $cookie) = @_; |
|
Subroutine
squish: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 37 | |||
| 38 | 4 | return [ sort keys %$cookie ]; | |
| 39 | } | ||
| 40 | |||
| 41 | sub long_usage { | ||
| 42 | 0 | ▶ | return <<EOF; |
|
Subroutine
long_usage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 43 | Usage: uarray,<field> | ||
| 44 | Collect unique values from specified field into an array. | ||
| 45 | EOF | ||
| 46 | } | ||
| 47 | |||
| 48 | sub short_usage { | ||
| 49 | 1 | ▶ | return "collect unique values from provided field into an array"; |
|
Subroutine
short_usage: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 50 | } | ||
| 51 | |||
| 52 | sub argct { | ||
| 53 | 0 | ▶ | return 1; |
|
Subroutine
argct: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 54 | } | ||
| 55 | |||
| 56 | sub initial { | ||
| 57 | 4 | ▶ | return {}; |
|
Subroutine
initial: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 58 | } | ||
| 59 | |||
| 60 | sub combine { | ||
| 61 | 16 | ▶ | my ($this, $cookie, $record) = @_; |
|
Subroutine
combine: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 62 | |||
| 63 | 16 | my $value = $this->{'valuation'}->evaluate_record($record); | |
| 64 | |||
| 65 | 16 | $cookie->{$value} = 1; | |
| 66 | |||
| 67 | 16 | return $cookie; | |
| 68 | } | ||
| 69 | |||
| 70 | 7 | App::RecordStream::Aggregator->register_implementation('uarray', __PACKAGE__); | |
| 71 | |||
| 72 | 7 | App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'uarray', 'VALUATION'); | |
| 73 | |||
| 74 | 7 | 1; | |