NAME
Catmandu::Importer::MARC - Package that imports MARC data
SYNOPSIS
use Catmandu::Importer::MARC;
my $importer = Catmandu::Importer::MARC->new(file => "/foo/bar.marc", type=> "USMARC");
my $n = $importer->each(sub {
my $hashref = $_[0];
# ...
});
MARC
The parsed MARC is a HASH containing two keys '_id' containing the 001 field (or the system identifier of the record) and 'record' containing an ARRAY of ARRAYs for every field:
{
'record' => [
[
'001',
undef,
undef,
'_',
'fol05882032 '
],
[
245,
'1',
'0',
'a',
'Cross-platform Perl /',
'c',
'Eric F. Johnson.'
],
],
'_id' => 'fol05882032'
}
METHODS
new(file => $filename,type=>$type,[id=>$id_field])
Create a new MARC importer for $filename. Use STDIN when no filename is given. Type describes the sytax of the MARC records. Currently we support: USMARC, MicroLIF , XML and ALEPHSEQ. Optionally provide an 'id' option pointing to the identifier field of the MARC record (default 001).
count
each(&callback)
...
Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. The Catmandu::Importer::MARC methods are not idempotent: MARC feeds can only be read once.