line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
795
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Catmandu::Util qw(is_string); |
7
|
1
|
|
|
1
|
|
7
|
use Catmandu; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
8
|
1
|
|
|
1
|
|
8
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
9
|
1
|
|
|
1
|
|
260
|
use namespace::clean; |
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
15
|
|
10
|
1
|
|
|
1
|
|
350
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
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
|
|
|
|
|
|
|
|