| 1 | package FormValidator::Simple::Iterator; | ||||||||||
| 2 | 10 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 2 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 5 | 2 | my $class = shift; | |||||||||
| 6 | 2 | my $self = bless { }, $class; | |||||||||
| 7 | 2 | $self->_init(@_); | |||||||||
| 8 | 2 | return $self; | |||||||||
| 9 | } | ||||||||||
| 10 | |||||||||||
| 11 | 2 | ▶ | sub _init { | ||||||||
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | my ($self, $records) = @_; | |||||||||
| 13 | 2 | $self->{_index} = 0; | |||||||||
| 14 | 2 | $self->{_records} = $records; | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | 1 | ▶ | sub reset { | ||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 18 | 1 | my $self = shift; | |||||||||
| 19 | 1 | $self->{_index} = 0; | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 9 | ▶ | sub next { | ||||||||
|
Subroutine
next: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | 9 | my $self = shift; | |||||||||
| 24 | 9 | ▶ | return unless ($self->{_records}->records_count > $self->{_index}); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 7 | my $record = $self->{_records}->get_record_at($self->{_index}); | |||||||||
| 26 | 7 | $self->{_index}++; | |||||||||
| 27 | 7 | return $record; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 10 | 1; | |||||||||
| 31 | __END__ | ||||||||||