NAME

Iterator::GroupedRange - Iterates rows is grouped by range

SYNOPSIS

use Iterator::GroupedRange;

my @ds = (
  [ 1 .. 6 ],
  [ 7 .. 11 ],
  [ 11 .. 25 ],
);

my $i1 = Iterator::GroupedRange->new( sub { shift @ds; }, 10 );
$i1->next; # [ 1 .. 10 ]
$i1->next; # [ 11 .. 20 ]
$i1->next; # [ 21 .. 25 ]

my $i2 = Iterator::GroupedRange->new( [ 1 .. 25 ], 10 );
$i2->next; # [ 1 .. 10 ]
$i2->next; # [ 11 .. 20 ]
$i2->next; # [ 21 .. 25 ]

DESCRIPTION

Iterator::GroupedRange is module to iterate rows grouped by range. It accepts other iterator to get rows, or list.

METHODS

new( \&iterator[, $range] )

Return new instance. The range variable is default 1000.

new( \@list[, $range] )

Return new instance. The range variable is default 1000.

has_next()

Return which has next rows or not.

next()

Return next rows.

is_last()

Return which is ended of iteration or not.

AUTHOR

Toru Yamaguchi <zigorou@cpan.org>

SEE ALSO

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.