Catman...RC::XML(3pm)

πŸ“¦
version 1.320 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– 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 an IO::Handle. if you don't specify this one, Catmandu::Util::io gets called to create the output handle β€” either from the file argument, or by falling back to STDOUT. (yes, STDOUT. she'll just start talking if you don't stop her. πŸ™ˆ)
  • fix β€” an ARRAY of 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 a marc:collection header 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