Catman...RC::MiJ(3pm)
β¨ NAME β¨
Catmandu::Exporter::MARC::MiJ β bestie, it's the exporter that takes your MARC records and turns them into MARC in JSON π
(yes, the manual page itself goes by Catman...RC::MiJ(3pm) β that's just its β¨ government name β¨, we don't use it in polite conversation π
)
π¦ SYNOPSIS π¦
okay so here's how you actually use this thing, from the command line:
# From the command line
$ catmandu convert MARC --type XML to MARC --type MiJ < /foo/bar.xml
and here's the same glow-up from Perl, no cap:
# 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;
π CONFIGURATION π
these are the knobs you can turn, and honestly each one is iconic in its own way:
fileβ write the output to a local file, given either by its path or by a file handle. alternatively? you can hand it a scalar reference and it'll write into a string instead, or a code reference and it'll write to a callback function. versatile queen πfhβ write the output to anIO::Handle. if you don't specify one,Catmandu::Util::iogets recruited to build the output handle out of thefileargument, or just falls back toSTDOUT. she'll figure it out π«Άfixβ anARRAYof one or more fixes or file scripts that get applied to the exported items. glow-up pass β¨encodingβ the binmode of the output streamfh. it's set to":utf8"by default. π
π METHODS π
for the full menu of methods, go look at Catmandu::Exporter, Catmandu::Addable, Catmandu::Fixable, Catmandu::Counter, and Catmandu::Logger. that's the whole squad, they've got you covered π«Ά
π FORMAT π
so the MARC-in-JSON record format has exactly two fields, and they are:
'leader'β the MARC leader'fields'β an array of MARC fields
each item inside that MARC fields array holds the MARC tag, and as its value a hash with three fields in it:
'subfields'β an array of MARC subfields'ind1'β the first indicator of the MARC tag'ind2'β the second indicator of the MARC tag
and each subfield item is a hash containing the MARC subfield tag and its value. nesting dolls but make it cataloguing πͺ
here's what one MARC record looks like all dressed up in the MiJ serialization format:
{
"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": " "
}
},
...
}
β SEE ALSO β
- Catmandu::Exporter β go read it, it's giving main character energy π
mwah, that's the whole page bestie π this was documented with perl v5.38.2 on 2024-08-03, so if you're reading this from the future, hi, you're slaying π«Άβ¨
π¦ where this page comes from
- debian trixie: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms