line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
17
|
|
|
17
|
|
354017
|
|
|
17
|
|
|
|
|
41
|
|
|
17
|
|
|
|
|
110
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
17
|
|
|
17
|
|
103
|
use namespace::clean; |
|
17
|
|
|
|
|
34
|
|
|
17
|
|
|
|
|
83
|
|
8
|
17
|
|
|
17
|
|
5073
|
|
|
17
|
|
|
|
|
38
|
|
|
17
|
|
|
|
|
106
|
|
9
|
|
|
|
|
|
|
with 'Catmandu::Importer'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has size => (is => 'ro'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my ($self) = @_; |
14
|
|
|
|
|
|
|
my $n = 0; |
15
|
|
|
|
|
|
|
sub { |
16
|
|
|
|
|
|
|
return if defined $self->size && $n == $self->size; |
17
|
|
|
|
|
|
|
return {n => $n++}; |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=pod |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Catmandu::Importer::Mock - Mock importer used for testing purposes |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SYNOPSIS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use Catmandu; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $importer = Catmandu->importer('Mock'); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $n = $importer->each(sub { |
37
|
|
|
|
|
|
|
my $hashref = $_[0]; |
38
|
|
|
|
|
|
|
# ... |
39
|
|
|
|
|
|
|
}); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 CONFIGURATION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=over |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item file |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Read input from a local file given by its path. Alternatively a scalar |
48
|
|
|
|
|
|
|
reference can be passed to read from a string. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item fh |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Read input from an L<IO::Handle>. If not specified, L<Catmandu::Util::io> is used to |
53
|
|
|
|
|
|
|
create the input stream from the C<file> argument or by using STDIN. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item encoding |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Binmode of the input stream C<fh>. Set to C<:utf8> by default. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item fix |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
An ARRAY of one or more fixes or file scripts to be applied to imported items. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item size |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Number of items. If not set, an endless stream is imported. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=back |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 METHODS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Every L<Catmandu::Importer> is a L<Catmandu::Iterable> all its methods are |
72
|
|
|
|
|
|
|
inherited. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SEE ALSO |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L<Catmandu::Exporter::Null> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |