File Coverage

blib/lib/Hadoop/Streaming/Reducer/Input/ValuesIterator.pm
Criterion Covered Total %
statement 3 13 23.0
branch 0 8 0.0
condition n/a
subroutine 1 3 33.3
pod 2 2 100.0
total 6 26 23.0


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