/usr/share/perl5/Catmandu/Exporter/MARC/MARCMaker.pm is in libcatmandu-marc-perl 0.206-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | =head1 NAME
Catmandu::Exporter::MARC::MARCMaker - Exporter for MARC records to USMARC
=head1 SYNOPSIS
# From the command line
$ catmandu convert MARC --type XML to MARC --type MARCMaker < /foo/data.mrc
# From Perl
use Catmandu;
my $importer = Catmandu->importer('MARC', file => "/foo/bar.mrc" , type => 'XML');
my $exporter = Catmandu->exporter('MARC', file => "marc.xml", type => 'MARCMaker' );
$exporter->add($importer);
$exporter->commit;
=head1 METHODS
=head2 new(file => $file , %opts)
Create a new L<Catmandu::Exporter> to serialize MARC record into MARCMaker. Provide the path
of a $file to write exported records to. Optionally the following paramters can be
specified:
record : the key containing the marc record (default: 'record')
record_format : optionally set to 'MARC-in-JSON' when the input format is in MARC-in-JSON
=head1 INHERTED METHODS
=head2 count
=head2 add($hashref)
=head2 add_many($array)
=head2 add_many($iterator)
=head2 add_many(sub {})
=head2 ...
All the L<Catmandu::Exporter> methods are inherited.
=head1 SEE ALSO
L<Catmandu::Exporter>
=cut
package Catmandu::Exporter::MARC::MARCMaker;
use Catmandu::Sane;
use Catmandu::Util qw(xml_escape is_different :array :is);
use Moo;
use MARC::Record;
use MARC::Field;
use MARC::File::MARCMaker;
with 'Catmandu::Exporter', 'Catmandu::Exporter::MARC::Base';
has record => (is => 'ro' , default => sub { 'record'});
has record_format => (is => 'ro' , default => sub { 'raw'} );
sub add {
my ($self, $data) = @_;
if ($self->record_format eq 'MARC-in-JSON') {
$data = $self->_json_to_raw($data);
}
my $marc = $self->_raw_to_marc_record($data->{$self->record});
$self->fh->print(MARC::File::MARCMaker::encode($marc));
}
sub commit {
my ($self) = @_;
$self->fh->flush;
}
1;
|