Catmandu::Importer::MARC - Package that imports MARC data
use Catmandu::Importer::MARC; # import records from file my $importer = Catmandu::Importer::MARC->new(file => "/foo/bar.marc", type=> "USMARC"); my $n = $importer->each(sub { my $hashref = $_[0]; # ... }); # import from array of MARC::Record objects my $importer = Catmandu::Importer::MARC->new(records => \@records); my $records = $importer->to_array;
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' }
Create a new MARC importer for $filename or $records. Use STDIN when no filename is given. Type describes the sytax of the MARC records. Currently we support: USMARC, MicroLIF , XML, ALEPHSEQ or MARC::Record. Optionally provide an 'id' option pointing to the identifier field of the MARC record (default 001).
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.
Catmandu::Iterable
To install Catmandu::MARC, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu::MARC
CPAN shell
perl -MCPAN -e shell install Catmandu::MARC
For more information on module installation, please visit the detailed CPAN module installation guide.