NAME
Data::Model::Iterator - Data::Model's iteration class
SYNOPSIS
use Data::Model::Iterator;
my @stack = qw( 1 2 );
my $itr = Data::Model::Iterator->new(
sub { ok(1, 'do shift'); shift @stack },
end => sub { ok(1, 'do end') },
reset => sub { ok(1, 'do reset') },
);
#
Dump($itr->next) if $itr->has_next;
# iteration
while (my $row = $itr->next) {
say $row;
# some code
}
while (<$itr>) {
say $_;
# some code
}
while (my $row = <$itr>) {
say $row;
# some code
}
for empty iteration
my $itr = Data::Model::Iterator::Empty->new;
return unless $itr; # bool overload
return unless $itr->has_next;
METHODS
has_next
next
reset
SEE ALSO
AUTHOR
Kazuhiro Osawa <yappo <at> shibuya <döt> pl>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 121:
Non-ASCII character seen before =encoding in '<döt>'. Assuming UTF-8