| 1 | package Hadoop::Streaming::Reducer::Input::ValuesIterator; | ||||||||||
| 2 | 6 | $Hadoop::Streaming::Reducer::Input::ValuesIterator::VERSION = '0.143060'; | |||||||||
| 3 | 6 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | with 'Hadoop::Streaming::Role::Iterator'; | |||||||||
| 5 | |||||||||||
| 6 | #ABSTRACT: Role providing access to values for a given key. | ||||||||||
| 7 | |||||||||||
| 8 | 6 | has input_iter => ( | |||||||||
| 9 | is => 'ro', | ||||||||||
| 10 | does => 'Hadoop::Streaming::Role::Iterator', | ||||||||||
| 11 | required => 1, | ||||||||||
| 12 | ); | ||||||||||
| 13 | |||||||||||
| 14 | 6 | has first => ( is => 'rw', ); | |||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | sub has_next | ||||||||||
| 18 | 376 | ▶ | { | ||||||||
|
Subroutine
has_next: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 19 | 376 | my $self = shift; | |||||||||
| 20 | 376 | ▶ | return 1 if $self->first; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 376 | ▶ | return unless defined $self->input_iter->input->next_key; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 371 | ▶ | return $self->input_iter->current_key eq | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | $self->input_iter->input->next_key ? 1 : 0; | ||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | sub next | ||||||||||
| 28 | 299 | ▶ | { | ||||||||
|
Subroutine
next: called CC=2 SCAR=7.9
Pod
documented
| |||||||||||
| 29 | 299 | my $self = shift; | |||||||||
| 30 | 299 | ▶ | if ( my $first = $self->first ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | { | ||||||||||
| 32 | 0 | $self->first(undef); | |||||||||
| 33 | 0 | return $first; | |||||||||
| 34 | } | ||||||||||
| 35 | 299 | my ( $key, $value ) = $self->input_iter->input->each; | |||||||||
| 36 | 299 | $value; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 6 | __PACKAGE__->meta->make_immutable; | |||||||||
| 40 | |||||||||||
| 41 | 6 | 1; | |||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||