line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
64
|
|
|
64
|
|
94015
|
|
|
64
|
|
|
|
|
120
|
|
|
64
|
|
|
|
|
482
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Role::Tiny::With; |
7
|
64
|
|
|
64
|
|
16959
|
use namespace::clean; |
|
64
|
|
|
|
|
10934
|
|
|
64
|
|
|
|
|
2876
|
|
8
|
64
|
|
|
64
|
|
413
|
|
|
64
|
|
|
|
|
152
|
|
|
64
|
|
|
|
|
424
|
|
9
|
|
|
|
|
|
|
with 'Catmandu::Iterable'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
bless $_[1], $_[0]; |
12
|
|
|
|
|
|
|
} |
13
|
78
|
|
|
78
|
0
|
1091
|
|
14
|
|
|
|
|
|
|
goto &{$_[0]}; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
75
|
|
|
75
|
1
|
118
|
1; |
|
75
|
|
|
|
|
235
|
|
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 |