Debian Codegraph @

lib/DBD/Mock/StatementTrack/Iterator.pm

raw
1 package DBD::Mock::StatementTrack::Iterator;
2
3 use strict;
4 use warnings;
5
6 sub new {
7 my ( $class, $history ) = @_;
8 bless {
9 pointer => 0,
10 history => $history || []
11 } => $class;
12 }
13
14 sub next {
15 my ($self) = @_;
16 return unless $self->{pointer} < scalar( @{ $self->{history} } );
17 return $self->{history}->[ $self->{pointer}++ ];
18 }
19
20 sub reset { (shift)->{pointer} = 0 }
21
22 1;