« blib/lib/App/RecordStream/Aggregator/InjectInto/Field.pm
↑ Summary
blib/lib/App/RecordStream/Aggregator/MapReduce/Field.pm »
| 1 | package App::RecordStream::Aggregator::Concatenate; | ||
| 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::MapReduce::Field; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 7 | ▶ | use App::RecordStream::Aggregator; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 7 | ▶ | use App::RecordStream::DomainLanguage::Registry; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 7 | ▶ | use base 'App::RecordStream::Aggregator::MapReduce::Field'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | sub new | ||
| 15 | { | ||
| 16 | 1 | ▶ | my $class = shift; |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 17 | 1 | my $delim = shift; | |
| 18 | 1 | my $field = shift; | |
| 19 | |||
| 20 | 1 | my $this = $class->SUPER::new($field); | |
| 21 | 1 | $this->{'delim'} = $delim; | |
| 22 | |||
| 23 | 1 | return $this; | |
| 24 | } | ||
| 25 | |||
| 26 | sub new_from_valuation | ||
| 27 | { | ||
| 28 | 0 | ▶ | my $class = shift; |
|
Subroutine
new_from_valuation: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 29 | 0 | my $delim = shift; | |
| 30 | 0 | my $valuation = shift; | |
| 31 | |||
| 32 | 0 | my $this = $class->SUPER::new_from_valuation($valuation); | |
| 33 | 0 | $this->{'delim'} = $delim; | |
| 34 | |||
| 35 | 0 | return $this; | |
| 36 | } | ||
| 37 | |||
| 38 | sub map_field | ||
| 39 | { | ||
| 40 | 4 | ▶ | my ($this, $value) = @_; |
|
Subroutine
map_field: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 41 | |||
| 42 | 4 | return [$value]; | |
| 43 | } | ||
| 44 | |||
| 45 | sub reduce | ||
| 46 | { | ||
| 47 | 3 | ▶ | my ($this, $cookie, $cookie2) = @_; |
|
Subroutine
reduce: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 48 | |||
| 49 | 3 | return [@$cookie, @$cookie2]; | |
| 50 | } | ||
| 51 | |||
| 52 | sub squish | ||
| 53 | { | ||
| 54 | 1 | ▶ | my ($this, $cookie) = @_; |
|
Subroutine
squish: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 55 | |||
| 56 | 1 | return join($this->{'delim'}, @$cookie); | |
| 57 | } | ||
| 58 | |||
| 59 | sub long_usage | ||
| 60 | { | ||
| 61 | 0 | ▶ | return <<EOF; |
|
Subroutine
long_usage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 62 | Usage: concat,<delimiter>,<field> | ||
| 63 | Concatenate values from specified field. | ||
| 64 | EOF | ||
| 65 | } | ||
| 66 | |||
| 67 | sub short_usage | ||
| 68 | { | ||
| 69 | 1 | ▶ | return "concatenate values from provided field"; |
|
Subroutine
short_usage: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 70 | } | ||
| 71 | |||
| 72 | sub argct | ||
| 73 | { | ||
| 74 | 0 | ▶ | return 2; |
|
Subroutine
argct: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 75 | } | ||
| 76 | |||
| 77 | 7 | App::RecordStream::Aggregator->register_implementation('concatenate', __PACKAGE__); | |
| 78 | 7 | App::RecordStream::Aggregator->register_implementation('concat', __PACKAGE__); | |
| 79 | |||
| 80 | 7 | App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'concatenate', 'SCALAR', 'VALUATION'); | |
| 81 | 7 | App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'concat', 'SCALAR', 'VALUATION'); | |
| 82 | |||
| 83 | 7 | 1; | |