MARC::...er::XML(3pm)
πΈ NAME πΈ
okay so bestie, let me introduce you to MARC::Parser::XML β it's the parser for MARC XML records. that's the whole vibe. the manual page for it is MARC::Parser::XML(3pm), and yeah the header truncates it like MARC::...er::XML(3pm) because manpage headers are dramatic like that π
β¨ SYNOPSIS β¨
literally all you need, no cap:
use MARC::Parser::XML;
my $parser = MARC::Parser::XML->new( 't/marc.xml' );
while ( my $record = $parser->next() ) {
# do something ...
}
π DESCRIPTION π
MARC::Parser::XML is a lightweight, fault tolerant parser for MARC XML records. π¦
here's the tea though β tags, indicators and subfield codes are NOT validated against the MARC standard. it's giving "we trust you, bestie" energy. no vibe check on your data, it just parses.
and the resulting data structure? it's optimized for usage with the Catmandu data tool kit. that's the whole point. iykyk π
π MARC π
the MARC record gets parsed into an ARRAY of ARRAYs. she's nested, she's iconic, she's a little chaotic:
$record = [
[ 'LDR', undef, undef, '_', '00661nam 22002538a 4500' ],
[ '001', undef, undef, '_', 'fol05865967 ' ],
...
[ '245', '1', '0', 'a', 'Programming Perl /',
'c', 'Larry Wall, Tom Christiansen & Jon Orwant.'
],
...
];
see how the subfields just keep going? a then the value, c then the value. no cap, that's the shape. π
π«Ά METHODS π«Ά
π new($file|$fh|$xml)
this is the constructor, the main character of getting started. you can feed her three different things and she'll take any of them:
"file"β path to file with MARC XML records. just hand her a path and she'll go find it. π"fh"β open filehandle for MARC XML records. already got one open? slay, pass it in."xml"β XML string. raw string of XML? she eats that too. π
πΈ next()
reads the next record from MARC input. that's it, that's the whole job. call it in a loop and she keeps handing you records until there aren't any left. periodt. β¨
π§ _decode($record)
deserialize a raw MARC record to an ARRAY of ARRAYs. this is the internal glow-up that turns the raw stuff into the pretty nested structure. π₯
π AUTHOR π
Johann Rolschewski <jorol@cpan.org> β the legend, the icon, the moment. π
π COPYRIGHT π
Copyright 2016- Johann Rolschewski
π LICENSE π
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π«Ά
π SEE ALSO π
okay bestie, this section is genuinely empty in the original. no cross-references, no extra reading, nothing. she stands alone. main character energy fr fr π
and that's the whole page!! this was MARC::...er::XML(3pm) from perl v5.32.1, dated 2021-09-29 β mwah, go parse some records, you got this π¦β¨π
π¦ where this page comes from
- debian bookworm: libmarc-parser-xml-perl 0.03-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmarc-parser-xml-perl 0.03-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libmarc-parser-xml-perl 0.03-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmarc-parser-xml-perl 0.03-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmarc-parser-xml-perl 0.03-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmarc-parser-xml-perl 0.03-2 Β· 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