/
marc_xml.pm
57 lines (34 loc) · 940 Bytes
/
marc_xml.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package Catmandu::Fix::marc_xml;
use Catmandu::Sane;
use Moo;
use Catmandu::MARC;
use Catmandu::Fix::Has;
with 'Catmandu::Fix::Inlineable';
our $VERSION = '1.04';
has path => (fix_arg => 1);
# Transform a raw MARC array into MARCXML
sub fix {
my ($self, $data) = @_;
my $xml = Catmandu::MARC->instance->marc_xml($data);
$data->{$self->path} = $xml;
$data;
}
=head1 NAME
Catmandu::Fix::marc_xml - transform a Catmandu MARC record into MARCXML
=head1 SYNOPSIS
# Transforms the 'record' key into a MARCXML string
marc_xml('record')
=head1 DESCRIPTION
Convert MARC data into a MARCXML string
=head1 METHODS
=head2 marc_xml(PATH)
Transform the MARC record found at PATH to MARC XML.
=head1 INLINE
This Fix can be used inline in a Perl script:
use Catmandu::Fix::marc_xml as => 'marc_xml';
my $data = { record => [...] };
$data = marc_xml($data);
=head1 SEE ALSO
L<Catmandu::Fix>
=cut
1;