SYNOPSIS
package My::MockIterator;
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 });