MARC::...er::RAW(3pm)
β¨ 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 π
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 wasperl v5.36.0, dated2022-12-06, from the User Contributed Perl Documentation forMARC::Parser::RAW(3pm). Slay, go parse some MARC records, bestie πβ¨π
π¦ where this page comes from
- debian bookworm: libmarc-parser-raw-perl 0.06-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmarc-parser-raw-perl 0.06-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmarc-parser-raw-perl 0.06-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libmarc-parser-raw-perl 0.06-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms