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