Catman...::MARC(3pm)

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

πŸ’– NAME πŸ’–

okay so bestie, <pink>Catmandu::Importer::MARC</pink> is literally the package that imports MARC data. that's it, that's the vibe. ✨

this page lives in the Catman...::MARC(3pm) man page, section 3pm, and we're gonna get through it together. grab a strawberry πŸ“ and let's go.


🌸 SYNOPSIS 🌸

fr fr, here's how you actually use it. all of this is copy-paste-able, no cap:

    # On the command line

    # Convert MARC to JSON (default)
    $ catmandu convert MARC < /foo/bar.mrc

    # Convert MARC to MARC
    $ catmandu convert MARC to MARC < /foo/bar.mrc > /foo/output.mrc

    # Add fixes
    $ catmandu convert MARC to MARC --fix myfixes.txt < /foo/bar.mrc > /foo/output.mrc

    # Create a list of titles
    $ catmandu convert MARC to TSV --fix "marc_map(245,title); retain(title)" < /foo/bar.mrc

    # Convert MARC XML
    $ catmandu convert MARC --type XML < /foo/bar.xml

    # Convert ALEPH sequential
    $ catmandu convert MARC --type ALEPHSEQ < /foo/bar.aleph

    # Convert on format to another format
    $ catmandu convert MARC --type ISO to MARC --type ALEPHSEQ < /foo/bar.mrc > /foo/bar.aleph

like… converting formats back and forth?? that's giving main character energy πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so <purple>Catmandu::Importer::MARC</purple> is a Catmandu::Importer whose whole job is pulling MARC records in from an external source. and every single record it imports? it comes out as a HASH with exactly two keys. iconic behavior honestly.

  • "_id" β€” this is the system identifier of the record, which is usually the 001 field πŸ’…
  • "record" β€” an ARRAY of ARRAYs holding the actual record data

πŸŽ€ EXAMPLE ITEM πŸŽ€

look at this lil guy. this is what a record looks like:

     {
        record => [
          [
            '001',
            undef,
            undef,
            '_',
            'fol05882032 '
          ],
          [
            '245',
            '1',
            '0',
            'a',
            'Cross-platform Perl /',
            'c',
            'Eric F. Johnson.'
          ],
        ],
        _id' => 'fol05882032'
     }

okay yes the _id' has a lil stray quote in there, that's literally how it's written, don't @ me, I'm not touching it πŸ’€


πŸ’œ METHODS πŸ’œ

this module inherits all the methods of <lavender>Catmandu::Importer</lavender>, and by extension, all of <lavender>Catmandu::Iterable</lavender>. so like, it's got the whole family tree backing it up. 🫢


✨ CONFIGURATION ✨

here's where you get to customize your experience, bestie:

  • file β€” read input from a local file by giving its path. orrr you can pass a scalar reference instead and read straight from a string. versatile queen 🌈
  • fh β€” read input from an IO::Handle. and if you don't specify it? then Catmandu::Util::io is used to build the input stream from the "file" argument, or by using STDIN. iykyk.
  • fix β€” an ARRAY of one or more fixes or file scripts that get applied to the imported items. this is your glow-up station πŸ’…
  • type β€” the MARC format to parse. here are all the MARC parsers available:
      ISO: L<Catmandu::Importer::MARC::ISO> (default) - a strict ISO 2709 parser
      RAW: L<Catmandu::Importer::MARC::RAW> - a loose ISO 2709 parser that skips faulty records
      ALEPHSEQ: L<Catmandu::Importer::MARC::ALEPHSEQ> - a parser for Ex Libris Aleph sequential files
      Line: L<Catmandu::Importer::MARC::Line> - a parser for Index Data's MARC Line format
      Lint: L<Catmandu::Importer::MARC::Lint> - a MARC syntax checker
      MicroLIF: L<Catmandu::Importer::MARC::MicroLIF> - a parser for the MicroLIF format
      MARCMaker: L<Catmandu::Importer::MARC::MARCMaker> - a parser for 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 format

like, nine whole parsers?? pick your fighter πŸ₯Š

  • skip_errors β€” if you set this, then any errors that pop up while parsing MARC input get skipped and ignored entirely. wanna see all those error messages though? use the debug setting of catmandu:
      $ catmandu -D convert MARC --skip_errors 1 < /foo/bar.mrc
  • <other> β€” every MARC importer can have its own options, so go check the documentation of the specific importer you're using. don't assume, bestie, read the docs πŸ’–

🌟 SEE ALSO 🌟

  • Catmandu::Exporter::MARC β€” the other half of the equation, go say hi

ok that's the whole page!! every flag, every parser, every default, all accounted for. nothing skipped, nothing invented. periodt. πŸ’…

and that's a wrap, bestie! this page came to you from perl v5.38.2, dated 2024-08-03, and it's filed under Catman...::MARC(3pm) in the User Contributed Perl Documentation. now go import some MARC records, you absolute legend πŸ‘‘πŸ’–

πŸ“¦ where this page comes from