| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  |  | 
| 2 |  |  |  |  |  |  | use Catmandu::Sane; | 
| 3 | 65 |  |  | 65 |  | 88304 |  | 
|  | 65 |  |  |  |  | 136 |  | 
|  | 65 |  |  |  |  | 523 |  | 
| 4 |  |  |  |  |  |  | our $VERSION = '1.2019'; | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | use Role::Tiny::With; | 
| 7 | 65 |  |  | 65 |  | 17561 | use namespace::clean; | 
|  | 65 |  |  |  |  | 11137 |  | 
|  | 65 |  |  |  |  | 2947 |  | 
| 8 | 65 |  |  | 65 |  | 373 |  | 
|  | 65 |  |  |  |  | 170 |  | 
|  | 65 |  |  |  |  | 403 |  | 
| 9 |  |  |  |  |  |  | with 'Catmandu::Iterable'; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | bless $_[1], $_[0]; | 
| 12 |  |  |  |  |  |  | } | 
| 13 | 78 |  |  | 78 | 0 | 1001 |  | 
| 14 |  |  |  |  |  |  | goto &{$_[0]}; | 
| 15 |  |  |  |  |  |  | } | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 75 |  |  | 75 | 1 | 109 | 1; | 
|  | 75 |  |  |  |  | 245 |  | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | =pod | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | =head1 NAME | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | Catmandu::Iterator - Base class for all Catmandu iterators | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | package My::MockIterator; | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | use Catmandu; | 
| 31 |  |  |  |  |  |  | use Moo; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | with 'Catmandu::Iterable'; | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | sub generator { | 
| 36 |  |  |  |  |  |  | sub { | 
| 37 |  |  |  |  |  |  | # Generator some random data | 
| 38 |  |  |  |  |  |  | +{ random => rand }; | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | package main; | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | my $it = My::MockIterator->new; | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | my $first = $it->first; | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | $it->each(sub { | 
| 49 |  |  |  |  |  |  | my $item = shift; | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | print $item->{random} , "\n"; | 
| 52 |  |  |  |  |  |  | }); | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | my $it2 = $it->map(sub { shift->{random} * 2 }); | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | =head1 METHODS | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | =head2 generator | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | Should return a closure that generates one Perl hash. | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | =head1 INHERIT | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | If you provide a generator, then the class will generator all methods from L<Catmandu::Iterable>. | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | L<Catmandu::Iterable> | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | =cut |