File Coverage

blib/lib/Data/Enumerator/Repeat.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 26 27 96.3


line stmt bran cond sub pod time code
1             package Data::Enumerator::Repeat;
2 2     2   15 use strict;
  2         5  
  2         81  
3 2     2   12 use warnings;
  2         5  
  2         79  
4 2     2   171 use base qw/Data::Enumerator::Base/;
  2         3  
  2         744  
5              
6             sub iterator {
7 3     3 0 5 my ($self) = @_;
8 3         21 my $object_iterator = $self->object->iterator;
9 3         6 my $repeated_iterator;
10             $repeated_iterator = sub {
11 148     148   429 my $value = $object_iterator->();
12 148 100       485 if ( $self->is_last($value) ) {
13 24         68 $object_iterator = $self->object->iterator;
14 24         114 return $repeated_iterator->();
15             }
16 124         347 return $value;
17 3         12 };
18 3         19 return $repeated_iterator;
19             }
20             1;