line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
574
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Catmandu::Util qw(is_string); |
7
|
1
|
|
|
1
|
|
6
|
use Catmandu; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
53
|
|
8
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
9
|
1
|
|
|
1
|
|
199
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
10
|
1
|
|
|
1
|
|
281
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Exporter'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has exporters => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
default => sub {[]}, |
16
|
|
|
|
|
|
|
coerce => sub { |
17
|
|
|
|
|
|
|
my $exporters = $_[0]; |
18
|
|
|
|
|
|
|
return [ |
19
|
|
|
|
|
|
|
map { |
20
|
|
|
|
|
|
|
if (is_string($_)) { |
21
|
|
|
|
|
|
|
Catmandu->exporter($_); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else { |
24
|
|
|
|
|
|
|
$_; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} @$exporters |
27
|
|
|
|
|
|
|
]; |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my ($self, $data) = @_; |
32
|
|
|
|
|
|
|
$_->add($data) for @{$self->exporters}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my ($self) = @_; |
36
|
|
|
|
|
|
|
$_->commit for @{$self->exporters}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Catmandu::Exporter::Multi - export you data to multiple exporters |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# this will write both a CSV and an XLS file |
51
|
|
|
|
|
|
|
my $exporter = Catmandu::Exporter::Multi->new(exporters => [ |
52
|
|
|
|
|
|
|
Catmandu::Exporter::CSV->new(file => 'mydata.csv'), |
53
|
|
|
|
|
|
|
Catmandu::Exporter::XLS->new(file => 'mydata.xls'), |
54
|
|
|
|
|
|
|
]); |
55
|
|
|
|
|
|
|
$exporter->add({col1 => 'val1', col2 => 'val2'}); |
56
|
|
|
|
|
|
|
$exporter->commit; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SEE ALSO |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L<Catmandu::Exporter> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|