line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
2
|
|
|
2
|
|
86424
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
11
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
2
|
|
|
2
|
|
14
|
use namespace::clean; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
8
|
|
8
|
2
|
|
|
2
|
|
588
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
8
|
|
9
|
|
|
|
|
|
|
with 'Catmandu::Exporter'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has _data_ => (is => 'ro', default => sub {[]}); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my ($self, $data) = @_; |
14
|
|
|
|
|
|
|
push @{$self->_data_}, $data; |
15
|
|
|
|
|
|
|
1; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my ($self) = @_; |
19
|
|
|
|
|
|
|
return $self->_data_; |
20
|
|
|
|
|
|
|
} |
21
|
2
|
|
|
2
|
0
|
1125
|
|
22
|
2
|
|
|
|
|
15
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=pod |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Catmandu::Exporter::Mock - a exporter that doesn't export anything |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# From the commandline |
34
|
|
|
|
|
|
|
$ catmandu convert JSON --fix myfixes to Mock < /tmp/data.json |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# From Perl |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use Catmandu; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Print to STDOUT |
41
|
|
|
|
|
|
|
my $exporter = Catmandu->exporter('Mock',fix => 'myfix.txt'); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$exporter->add_many($arrayref); |
44
|
|
|
|
|
|
|
$exporter->add_many($iterator); |
45
|
|
|
|
|
|
|
$exporter->add_many(sub { }); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$exporter->add($hashref); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
printf "exported %d items\n" , $exporter->count; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Get an array ref of all records exported |
52
|
|
|
|
|
|
|
my $data = $exporter->as_arrayref; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This exporter exports nothing and can be used as in situations where you e.g. export |
57
|
|
|
|
|
|
|
data from a fix. Other the Null exporter, the Mock exporter will keep an internal |
58
|
|
|
|
|
|
|
array of all the records exported which can be retrieved with the 'as_arrayref' method. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SEE ALSO |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
L<Catmandu::Exporter::Null> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |