line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
668
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Catmandu::Util qw(is_string); |
7
|
1
|
|
|
1
|
|
6
|
use Catmandu; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
8
|
1
|
|
|
1
|
|
5
|
use Catmandu::MultiIterator; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
9
|
1
|
|
|
1
|
|
574
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
52
|
|
10
|
1
|
|
|
1
|
|
6
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
11
|
1
|
|
|
1
|
|
316
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
4
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Importer'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has importers => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
default => sub {[]}, |
17
|
|
|
|
|
|
|
coerce => sub { |
18
|
|
|
|
|
|
|
my $importers = $_[0]; |
19
|
|
|
|
|
|
|
return [ |
20
|
|
|
|
|
|
|
map { |
21
|
|
|
|
|
|
|
if (is_string($_)) { |
22
|
|
|
|
|
|
|
Catmandu->importer($_); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
else { |
25
|
|
|
|
|
|
|
$_; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} @$importers |
28
|
|
|
|
|
|
|
]; |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my ($self) = @_; |
33
|
|
|
|
|
|
|
sub { |
34
|
|
|
|
|
|
|
state $generators = [map {$_->generator} @{$self->importers}]; |
35
|
|
|
|
|
|
|
while (@$generators) { |
36
|
|
|
|
|
|
|
my $data = $generators->[0]->(); |
37
|
|
|
|
|
|
|
return $data if defined $data; |
38
|
|
|
|
|
|
|
shift @$generators; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
return; |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=pod |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Catmandu::Importer::Multi - Chain multiple importers together |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SYNOPSIS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
use Catmandu::Importer::Multi; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $importer = Catmandu::Importer::Multi->new(importers => [ |
58
|
|
|
|
|
|
|
Catmandu::Importer::Mock->new, |
59
|
|
|
|
|
|
|
Catmandu::Importer::Mock->new, |
60
|
|
|
|
|
|
|
]); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $importer = Catmandu::Importer::Multi->new( |
63
|
|
|
|
|
|
|
'importer1', |
64
|
|
|
|
|
|
|
'importer2', |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# return all the items of each importer in turn |
68
|
|
|
|
|
|
|
$importer->each(sub { |
69
|
|
|
|
|
|
|
# ... |
70
|
|
|
|
|
|
|
}); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 METHODS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Every L<Catmandu::Importer> is a L<Catmandu::Iterable> all its methods are |
75
|
|
|
|
|
|
|
inherited. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |