Catman...::Line(3pm)

πŸ“¦
version 1.320 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– 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 an IO::Handle. if you don't specify one, Catmandu::Util::io gets called in to build the input stream from the file argument, or it just uses STDIN. so either way you're covered. πŸ’–
  • encoding β€” this is the binmode of the input stream fh. it's set to :utf8 by 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::Importer
  • Catmandu::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