Catman...::Line(3pm)
π Catmandu::Importer::MARC::Line β the whole vibe π
okay bestie, gather round π«Ά this is the manual page for Catmandu::Importer::MARC::Line, living in section 3pm of the perl docs (user contributed perl documentation, periodt). it's the package that pulls in Index Data's MARC Line records, and ngl it's lowkey iconic for it. β¨
πΈ NAME πΈ
Catmandu::Importer::MARC::Line β the package that imports Index Data's MARC Line records. that's it, that's the name, slay. π
π SYNOPSIS π
here's how you actually use it, straight up, no cap:
# From the command line
$ catmandu convert MARC --type Line --fix 'marc_map("245a","title")' < t/code4lib.line
$ catmandu convert MARC --type Line to MARC --type XML < t/code4lib.line
# From perl
use Catmandu;
# import records from file
my $importer = Catmandu->importer('MARC',file => 't/code4lib.line' , type => 'Line');
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};
});
like?? the way you can just pipe MARC Line in and get records out, or chain a fixer on top and print the titleβ¦ main character energy fr fr π
βοΈ CONFIGURATION βοΈ
these are the knobs you get to turn when you spin this importer up, bestie. every single one, no skipping π«Ά
fileβ read input from a local file, you just hand it the path. or π you can pass a scalar reference instead and it'll read from that string. cute, right?fhβ read input from anIO::Handle. if you don't specify one,Catmandu::Util::iogets called in to build the input stream from thefileargument, or it just uses STDIN. so either way you're covered. πencodingβ this is the binmode of the input streamfh. it's set to:utf8by default, so unless you say otherwise, utf8 is what you're getting. β¨fixβ an ARRAY of one or more fixes or file scripts, and they get applied to the imported items. yes, plural, an ARRAY, go wild. π
π οΈ METHODS π οΈ
every Catmandu::Importer is a Catmandu::Iterable, so all its methods are inherited. meaning you get the whole iterable toolkit for free, no extra work, we love an inheritance moment. π
π AUTHOR π
Johann Rolschewski, <jorol at cpan> β thank you for your service, legend. π«‘π
π SEE ALSO π
go read these next, bestie, they're the supporting cast:
Catmandu::ImporterCatmandu::Iterable
okay that's the whole page!! nothing skipped, nothing faked, every flag and path and default present and accounted for. vibe check: passed. β
and that's a wrap on the Catman...::Line(3pm) page, bestie β this one shipped with perl v5.38.2, dated 2024-08-03. π¦ thanks for reading, you ate. π
β¨
π¦ 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