Catman...RC::XML(3pm)
π Catman...RC::XML(3pm) π
okay so bestie, welcome to the User Contributed Perl Documentation page for Catmandu::Importer::MARC::XML β section 3pm, library page, you know the vibe. pull up a chair, grab a boba, we're doing this π§β¨
β¨ NAME β¨
Catmandu::Importer::MARC::XML β the package that imports MARCXML records. that's it, that's the whole job, and it does it gorgeously π
πΈ SYNOPSIS πΈ
here's the tea, two ways to do it. first, from the command line, like a main character:
# From the command line
$ catmandu convert MARC --type XML --fix "marc_map('245a','title')" < /foo/data.xml
then from perl, if that's more your era:
# From perl
use Catmandu;
# import records from file
my $importer = Catmandu->importer('MARC',file => '/foo/data.xml', type => 'XML');
my $fixer = Catmandu->fixer("marc_map('245a','title')");
$importer->each(sub {
my $item = shift;
...
});
# or using the fixer
$fixer->fix($importer)->each(sub {
my $item = shift;
printf "title: %s\n" , $item->{title};
});
the way that last one just fixes the importer and then iterates... obsessed ππ«Ά
π CONFIGURATION π
all the knobs and dials, no gatekeeping:
idβ the MARC field that's holding the system id. default?001. iconic of it honestly.fileβ read your input from a local file, and you just hand it the path. or β plot twist β you can pass a scalar reference and read from a string instead. versatile queen πfhβ read input from anIO::Handle. if you don't specify one,Catmandu::Util::iogets drafted in to build the input stream from the"file"argument, or just fromSTDINif you're feeling casual.encodingβ binmode of the input streamfh. it's set to":utf8"by default, so like, it's already handled bestie.fixβ anARRAYof one or more fixes or file scripts to apply to the imported items. stack 'em, layer 'em, slay β¨
π₯ METHODS π₯
real talk: every Catmandu::Importer is a Catmandu::Iterable, so all its methods are inherited. you don't need a separate list, you got the whole family tree for free π
π« SEE ALSO π«
go read these next, they're the supporting cast:
Catmandu::ImporterCatmandu::Iterable
ngl there's nothing dangerous in here, it's just a very chill importer. no cap π¦
and that's the page fr fr β brought to you by perl v5.38.2, dated 2024-08-03, and yes the footer really does call it Catman...RC::XML(3pm) again because it said it twice π we love a consistent queen. bye bestie, go import something cute ππΈβ¨
π¦ where this page comes from
- debian trixie: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-marc-perl 1.320-1 Β· 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