File Coverage

blib/lib/DBD/Mock/StatementTrack/Iterator.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition 1 2 50.0
subroutine 5 5 100.0
pod 0 3 0.0
total 21 25 84.0


line stmt bran cond sub pod time code
1             package DBD::Mock::StatementTrack::Iterator;
2              
3 40     40   288 use strict;
  40         95  
  40         1284  
4 40     40   251 use warnings;
  40         79  
  40         5799  
5              
6             sub new {
7 2     2 0 98 my ( $class, $history ) = @_;
8 2   50     33 bless {
9             pointer => 0,
10             history => $history || []
11             } => $class;
12             }
13              
14             sub next {
15 16     16 0 1171 my ($self) = @_;
16 16 100       31 return unless $self->{pointer} < scalar( @{ $self->{history} } );
  16         62  
17 12         55 return $self->{history}->[ $self->{pointer}++ ];
18             }
19              
20 1     1 0 4 sub reset { (shift)->{pointer} = 0 }
21              
22             1;