blib/lib/Catmandu/Importer/Null.pm

filter: Statementstmt 100% 15 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 95.0% 19 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Catmandu/Fix/reject.pm ↑ Summary blib/lib/Catmandu/Importer/Mock.pm »
1 package Catmandu::Importer::Null;
2  
3 2 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 our $VERSION = '1.0201_02';
6  
7 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 with 'Catmandu::Importer';
11  
12 sub generator {
13 5 ▶ my ($self) = @_;
Subroutine generator: called CC=1 SCAR=0.0
Pod undocumented
14 5 my $n = 0;
15 sub {
16 return undef if $n++;
17 +{};
18 5 };
19 }
20  
21 2 1;
22  
23 __END__
24  
25 =pod
26  
27 =head1 NAME
28  
29 Catmandu::Importer::Null - Null importer used for testing purposes
30  
31 =head1 SYNOPSIS
32  
33 # From the command line
34  
35 catmandu convert Null --fix 'add_field(foo,bar)'
36 # creates { "foo": "bar" }
37  
38 # In a Perl script
39 use Catmandu;
40  
41 my $importer = Catmandu->importer('Null');
42  
43 my $n = $importer->each(sub {
44 my $hashref = $_[0];
45 # ...
46 });
47  
48 =head1 DESCRIPTION
49  
50 The importer generates one empty record and then exists. This importer can be used to
51 test fix functions, generating a single record.
52  
53 =head1 METHODS
54  
55 Every L<Catmandu::Importer> is a L<Catmandu::Iterable> all its methods are
56 inherited.
57  
58 =head1 SEE ALSO
59  
60 L<Catmandu::Exporter::Null>
61  
62 =cut
« blib/lib/Catmandu/Fix/reject.pm ↑ Summary blib/lib/Catmandu/Importer/Mock.pm »