Catmandu::Iterator(3pm) | User Contributed Perl Documentation | Catmandu::Iterator(3pm) |
Catmandu::Iterator - Base class for all Catmandu iterators
package My::MockIterator; use Catmandu; use Moo; with 'Catmandu::Iterable'; sub generator { sub { # Generator some random data +{ random => rand }; } } package main; my $it = My::MockIterator->new; my $first = $it->first; $it->each(sub { my $item = shift; print $item->{random} , "\n"; }); my $it2 = $it->map(sub { shift->{random} * 2 });
Should return a closure that generates one Perl hash.
If you provide a generator, then the class will generator all methods from Catmandu::Iterable.
Catmandu::Iterable
2023-03-03 | perl v5.36.0 |