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