Catmandu::Exporter::MARC::MiJ - Exporter for MARC records to MARC in JSON
Contents
Configuration
file
Write output to a local file given by its path or file handle. Alternatively a scalar reference can
be passed to write to a string and a code reference can be used to write to a callback function.
fh Write the output to an IO::Handle. If not specified, Catmandu::Util::io is used to create the output
handle from the "file" argument or by using STDOUT.
fix An ARRAY of one or more fixes or file scripts to be applied to exported items.
encoding
Binmode of the output stream "fh". Set to "":utf8"" by default.
Format
The MARC-in-JSON record format contains two fields:
* 'leader' - the MARC leader
* 'fields' - an array of MARC fields
Each item in the MARC fields array contains the MARC tag and as value a hash containing three fields:
* 'subfields' - an array of MARC subfields
* 'ind1' - the first indicator of the MARC tag
* 'ind2' - the second indicator of the MARC tag
Each subfield item is an hash containing the MARC subfield tag and its value.
An example of one MARC record in the MiJ serialization format is given below:
{
"leader": "0000cam 2200000 4500",
"fields": [
{
"100": {
"subfields": [
{
"a": "Huberman, Leo,"
},
{
"d": "1903-1968."
}
],
"ind1": "1",
"ind2": " "
}
},
{
"700": {
"subfields": [
{
"a": "Sweezy, Paul M."
},
{
"q": "(Paul Marlor),"
},
{
"d": "1910-2004."
}
],
"ind1": "1",
"ind2": " "
}
},
...
}
Methods
See Catmandu::Exporter, Catmandu::Addable, Catmandu::Fixable, Catmandu::Counter, and Catmandu::Logger for
a full list of methods.
Name
Catmandu::Exporter::MARC::MiJ - Exporter for MARC records to MARC in JSON
See Also
Catmandu::Exporter
perl v5.38.2 2024-08-03 Catmandu::Exporter::MARC::MiJ(3pm)
Synopsis
# From the command line
$ catmandu convert MARC --type XML to MARC --type MiJ < /foo/bar.xml
# From Perl
use Catmandu;
my $importer = Catmandu->importer('MARC', file => "/foo/bar.xml" , type => 'XML');
my $exporter = Catmandu->exporter('MARC', file => "bar.json", type => 'MiJ' );
$exporter->add($importer);
$exporter->commit;
