line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Exporter::LIDO; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
537102
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
220
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
8
|
1
|
|
|
1
|
|
842
|
use Encode; |
|
1
|
|
|
|
|
7885
|
|
|
1
|
|
|
|
|
68
|
|
9
|
1
|
|
|
1
|
|
438
|
use Lido::XML; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Exporter'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'lido' => (is => 'lazy'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _build_lido { |
16
|
|
|
|
|
|
|
return Lido::XML->new; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub add { |
20
|
|
|
|
|
|
|
my ($self, $data) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $xml = $self->lido->to_xml($data); |
23
|
|
|
|
|
|
|
$self->fh->print(decode('UTF-8', $xml, Encode::FB_CROAK)); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub commit { |
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=pod |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Catmandu::Exporter::LIDO - a LIDO exporter |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# From the commandline |
43
|
|
|
|
|
|
|
$ catmandu convert JSON --fix myfixes to LIDO < /tmp/data.json |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# From Perl |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use Catmandu; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Print to STDOUT |
50
|
|
|
|
|
|
|
my $exporter = Catmandu->exporter('LIDO'); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$exporter->add_many($arrayref); |
53
|
|
|
|
|
|
|
$exporter->add_many($iterator); |
54
|
|
|
|
|
|
|
$exporter->add_many(sub { }); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$exporter->add($hashref); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
printf "exported %d objects\n" , $exporter->count; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Get an array ref of all records exported |
61
|
|
|
|
|
|
|
my $data = $exporter->as_arrayref; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DESCRIPTION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This is a L<Catmandu::Exporter> for converting Perl into LIDO XML (an XML Schema for |
66
|
|
|
|
|
|
|
Contributing Content to Cultural Heritage Repositories). |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L<Catmandu::Importer::LIDO>, L<Lido::XML> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |