package Iterator; use strict; use base qw(IteratorIF); sub new { my $class = shift; my $self = {}; $self->{itercollection} = shift; $self->{index} = -1; bless $self, $class; } sub hasNext { my $self = shift; if ($self->{index} < $self->{itercollection}->{total}-1) { $self->{index}++; return 1; } else { return 0; } } sub next { my $self = shift; return $self->{itercollection}->{collection}->[$self->{index}]; } 1;