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 39     39   287 use strict;
  39         101  
  39         1213  
4 39     39   205 use warnings;
  39         89  
  39         5918  
5              
6             sub new {
7 2     2 0 102 my ( $class, $history ) = @_;
8 2   50     15 bless {
9             pointer => 0,
10             history => $history || []
11             } => $class;
12             }
13              
14             sub next {
15 16     16 0 978 my ($self) = @_;
16 16 100       31 return unless $self->{pointer} < scalar( @{ $self->{history} } );
  16         55  
17 12         60 return $self->{history}->[ $self->{pointer}++ ];
18             }
19              
20 1     1 0 4 sub reset { (shift)->{pointer} = 0 }
21              
22             1;