MARC::...er::RAW(3pm)

πŸ“¦
version 0.06 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

✨ NAME ✨

MARC::Parser::RAW β€” a parser for ISO 2709 encoded MARC records, and bestie it's literally so chill about it πŸ’–


🌸 SYNOPSIS 🌸

use MARC::Parser::RAW;

my $parser = MARC::Parser::RAW->new( $file );

while ( my $record = $parser->next() ) {
    # do something
}

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so MARC::Parser::RAW is a lightweight, fault tolerant parser for ISO 2709 encoded MARC records. And when we say fault tolerant we mean it does not come for you about the rules:

  • Tags, indicators and subfield codes are not validated against the MARC standard.
  • Record length from leader and field lengths from the directory are ignored.

Records with a faulty structure? They get skipped, with a warning. No drama, no crash, just a little heads up πŸ’…

The resulting data structure is optimized for usage with the Catmandu data tool kit. It's giving data-toolkit main character energy, fr fr.

Also important: MARC::Parser::RAW expects UTF-8 encoded files as input. Otherwise, provide a filehandle with a specified I/O layer, or specify encoding. That's the vibe check you gotta pass 🫢


πŸŽ€ MARC πŸŽ€

The MARC record is parsed into an ARRAY of ARRAYs:

$record = [
        [ 'LDR', undef, undef, '_', '00661nam  22002538a 4500' ],
        [ '001', undef, undef, '_', 'fol05865967 ' ],
        ...
        [   '245', '1', '0', 'a', 'Programming Perl /',
            'c', 'Larry Wall, Tom Christiansen & Jon Orwant.'
        ],
        ...
    ];

Look at her. Nested arrays. Iconic. πŸ‘‘


πŸ’– METHODS πŸ’–

πŸ’« new($file|$fh|$scalarref [, $encoding])

Configuration time, bestie ✨

  • file β€” Path to file with raw MARC records.
  • fh β€” Open filehandle for raw MARC records.
  • scalarref β€” Reference to scalar with raw MARC records.
  • encoding β€” Set encoding. Default: UTF-8. Optional.

πŸ’« next()

Reads the next record from the MARC input stream. Returns a Perl hash. (Yes, the docs say hash, we're just reporting the facts 🫑)

πŸ’« _decode($record)

Deserialize a raw MARC record to an ARRAY of ARRAYs.

πŸ’« _field($field)

Split MARC field string in individual components.


🌈 AUTHOR 🌈

Johann Rolschewski <jorol@cpan.org>


Copyright 2014- Johann Rolschewski


🧚 LICENSE 🧚

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


⭐ SEEALSO ⭐

Catmandu, Catmandu::Importer::MARC.


πŸ“ ACKNOWLEDGEMENT πŸ“

The parser methods are adapted from Marc Chantreux's MARC::MIR module. Credit where credit is due, periodt πŸ’…


Okay that's the whole page, no cap. This was perl v5.36.0, dated 2022-12-06, from the User Contributed Perl Documentation for MARC::Parser::RAW(3pm). Slay, go parse some MARC records, bestie πŸ’–βœ¨πŸŽ€
πŸ“¦ where this page comes from