Catman...Record(3pm)

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

🌸 Catman...Record(3pm) β€” Catmandu::Importer::MARC::Record 🌸

okay bestie, so you found a perl manpage and you're like "what is this" β€” don't worry, I got you. This one lives in the User Contributed Perl Documentation corner of your system, and it's literally about a package that imports an array of MARC::Record into Catmandu. MARC records in, Catmandu items out. That's the whole vibe. πŸ’–


✨ NAME ✨

Catmandu::Importer::MARC::Record β€” the package that imports an array of MARC::Record. yep, that's the name, that's the job, no notes. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

here's how you actually use it, in all its perl glory β€” copy it exactly, don't be cute with it:

# From perl
use Catmandu;
use MARC::Record;

my $record = MARC::Record->new();
my $field = MARC::Field->new('245','','','a' => 'My title.');
$record->append_fields($field);

# import records from file
my $importer = Catmandu->importer('MARC',file => '/foo/data.mrc' , records => [$record]);
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};
});

so like β€” you build a MARC::Record, you shove a MARC::Field in there (245 with subfield a, iconic), you hand the whole array to the importer, and then either iterate raw or run it through the fixer first and get a cute little title key out the other side. it's giving pipeline. πŸ’…


πŸ’… METHODS πŸ’…

πŸŽ€ new(records => [ <Marc::Record> , ... ] , id => $field)

this is the constructor, bestie. it parses an array of MARC::Record into a Catmandu::Iterable β€” one record at a time, all chill.

and optionally you can hand it an id attribute, which tells it where to pull the system identifier from for the _id field. like, the source of the id. for example '001'. that's it, that's the option. 🫢


🌈 INHERTED METHODS 🌈

(yes, it says "INHERTED", we're keeping it, it's part of the charm πŸ’€)

  • count
  • each(&callback)
  • ...

and here's the tea: every Catmandu::Importer is a Catmandu::Iterable, so all its methods are inherited. all of them. the whole menu. so don't come for me asking where count came from β€” it's inherited, periodt. πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

  • MARC::Record

go read that one too if you wanna understand what you're actually feeding in here. iykyk. ✨


made with perl v5.38.2, dated 2024-08-03 β€” shoutout to the perl gang, ily, mwah πŸ’œ

πŸ“¦ where this page comes from