Package that imports MARC data
=head1 SYNOPSIS
# On the command line
# Convert MARC to JSON (default)
$ catmandu convert MARC < /foo/bar.mrc
# Convert MARC to MARC
$ catmandu c
or MARCMaker/MARCBreaker records
MiJ: L<Catmandu::Importer::MARC::MiJ> (MARC in JSON) - a parser for the MARC-in-JSON format
XML: L<Catmandu::Importer::MARC::XML> - a parser for the MARC XML forma
ata) = @_;
if (keys %$data) {
if ($self->record_format eq 'MARC-in-JSON') {
$data = $self->_json_to_raw($data);
}
if ($data->{$self->record}) {
my
=head1 NAME
Catmandu::Exporter::MARC::MiJ - Exporter for MARC records to MARC in JSON
=head1 SYNOPSIS
# From the command line
$ catmandu convert MARC --type XML to MARC --type MiJ < /foo/ba
le => "/foo/bar.xml" , type => 'XML');
my $exporter = Catmandu->exporter('MARC', file => "bar.json", type => 'MiJ' );
$exporter->add($importer);
$exporter->commit;
=head1 CONFIGURATION
tmandu::Counter>, and L<Catmandu::Logger> for a full list of methods.
=head1 FORMAT
The MARC-in-JSON record format contains two fields:
* 'leader' - the MARC leader
* 'fields' - an array of M
sub add {
my ($self, $data) = @_;
if ($self->record_format eq 'MARC-in-JSON') {
$data = $self->_json_to_raw($data);
}
for my $field (@{$data->{record}}) {
my ($fiel
record => $data } );
$exporter->commit;
return $xml;
}
}
sub marc_record_to_json {
my ( $self, $data, %opts ) = @_;
if ( my $marc = delete $data->{'record'} ) {
=> \@sf, ind1 => $ind1, ind2 => $ind2 } };
}
}
}
$data;
}
sub marc_json_to_record {
my ( $self, $data, %opts ) = @_;
my $record = [];
if ( Catmandu::Util::
];
my $data = $_[1];
my $json_path = $_[2];
my $marc_path = $_[3];
my $marc_value = $_[4];
my $value = Catmandu::Util::data_at( $json_path, $data );
return $data