line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::MultiIterator; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
747
|
use Catmandu::Sane; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
33
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
18
|
use Role::Tiny::With; |
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
118
|
|
8
|
2
|
|
|
2
|
|
14
|
use namespace::clean; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Catmandu::Iterable'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
1
|
|
|
1
|
0
|
31
|
my ($class, @iterators) = @_; |
14
|
1
|
|
|
|
|
3
|
my $self = \@iterators; |
15
|
1
|
|
|
|
|
4
|
bless $self, $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub generator { |
19
|
1
|
|
|
1
|
0
|
3
|
my ($self) = @_; |
20
|
|
|
|
|
|
|
sub { |
21
|
7
|
|
|
7
|
|
15
|
state $generators = [map {$_->generator} @$self]; |
|
2
|
|
|
|
|
8
|
|
22
|
7
|
|
|
|
|
16
|
while (@$generators) { |
23
|
8
|
|
|
|
|
14
|
my $data = $generators->[0]->(); |
24
|
8
|
100
|
|
|
|
23
|
return $data if defined $data; |
25
|
2
|
|
|
|
|
8
|
shift @$generators; |
26
|
|
|
|
|
|
|
} |
27
|
1
|
|
|
|
|
3
|
return; |
28
|
1
|
|
|
|
|
7
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=pod |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Catmandu::MultiIterator - chain multiple iterators together |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $it = Catmandu::MultiIterator->new( |
44
|
|
|
|
|
|
|
Catmandu::Importer::Mock->new, |
45
|
|
|
|
|
|
|
Catmandu::Importer::Mock->new, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# return all the items of each importer in turn |
49
|
|
|
|
|
|
|
$it->each(sub { |
50
|
|
|
|
|
|
|
# ... |
51
|
|
|
|
|
|
|
}); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 METHODS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
All L<Catmandu::Iterable> methods are available. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |