Catman...RC::XML(3pm)
π Catmandu::Exporter::MARC::XML β the NAME section, bestie β¨
okay so. this is Catmandu::Exporter::MARC::XML, and it's the Exporter for MARC records to MARCXML. that's it, that's the whole vibe. you feed it MARC, it hands you back XML, and it does it flawlessly. no cap. π¦
it lives in the User Contributed Perl Documentation corner of your friendly neighborhood 3pm manual pages, so you already know it's the real deal.
πΈ SYNOPSIS πΈ
here's how you summon it. first, the glow-up from the command line:
# From the command line
$ catmandu convert MARC to MARC --type XML < /foo/data.mrc
and here's the Perl girlie way, if you're the type to write code instead of just yelling at your terminal (both are valid π ):
# From Perl
use Catmandu;
my $importer = Catmandu->importer('MARC', file => "/foo/bar.mrc" , type => 'ISO');
my $exporter = Catmandu->exporter('MARC', file => "marc.xml", type => 'XML' );
$exporter->add($importer);
$exporter->commit;
see how the importer reads ISO and the exporter writes XML? that's the pipeline, and it's giving main character energy. you add everything in, then you commit and it's done. periodt. π
β¨ DESCRIPTION β¨
Catmandu::Exporter::MARC::XML serializes MARC records as XML. that's literally the whole job description and honestly? she ate. π
π«Ά CONFIGURATION π«Ά
every one of these lil settings you can pass in, and every single one matters, so pay attention bestie:
fileβ write your output to a local file, given by its path, or hand it a file handle. OR (and this is the fun part) you can pass a scalar reference and it writes to a string instead, or a code reference and it writes to a callback function. choose your own adventure. π«fhβ write the output to anIO::Handle. if you don't specify this one,Catmandu::Util::iogets called to create the output handle β either from thefileargument, or by falling back toSTDOUT. (yes,STDOUT. she'll just start talking if you don't stop her. π)fixβ anARRAYof one or more fixes or file scripts to be applied to exported items. glow-up your records on the way out. πrecordβ the key containing the marc record. default:'record'πrecord_formatβ optionally set this to'MARC-in-JSON'when the input format is in MARC-in-JSON. iykyk. π₯collectionβ add amarc:collectionheader when true. default:trueβ¨xml_declarationβ add a xml declaration when true. default:trueπskip_empty_subfieldsβ skip fields which don't contain any data. default:falseπ§prettyβ pretty-print XML. that's it, that's the option. make it cute. π
ngl bestie, those defaults are doing a LOT of heavy lifting for you, so don't be surprised when you get a collection header and an xml declaration without asking. that's just her being helpful. π«Ά
π METHODS π
want the full list of methods? go read Catmandu::Exporter, Catmandu::Addable, Catmandu::Fixable, Catmandu::Counter, and Catmandu::Logger. that's where the whole roster lives. fr fr. β
π¦ SEE ALSO π¦
Catmandu::Importer::MARC::XMLβ the other half of the situationship. importer and exporter, iconic duo, no notes. π
and that's the whole page, bestie!! π this was perl v5.38.2, dated 2024-08-03, from the Catman...RC::XML(3pm) corner of the manual. go forth and serialize your MARC records, you absolute legend. mwah. ππ
π
π¦ 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