Catmandu::Importer::MARC - Package that imports MARC data
use Catmandu; # import records from file my $importer = Catmandu->importer('MARC',file => '/foo/bar.mrc'); my $count = $importer->each(sub { my $record = shift; # ... }); # import records and apply a fixer my $fixer = fixer("marc_map('245a','title')"); $fixer->fix($importer)->each(sub { my $record = shift; printf "title: %s\n" , $record->{title}; }); # Convert MARC to JSON mapping 245a to a title with the L<catmandu> command line client: catmandu convert MARC --fix "marc_map('245a','title')" < /foo/bar.mrc
Catmandu::Importer::MARC is a Catmandu::Importer to import MARC records from an external source. Each record is imported as HASH containing two keys:
_id
the system identifier of the record (usually the 001 field)
record
an ARRAY of ARRAYs containing the record data
{ record => [ [ '001', undef, undef, '_', 'fol05882032 ' ], [ '245', '1', '0', 'a', 'Cross-platform Perl /', 'c', 'Eric F. Johnson.' ], ], _id' => 'fol05882032' }
This module inherits all methods of Catmandu::Importer and by this Catmandu::Iterable.
In addition to the configuration provided by Catmandu::Importer (file, fh, etc.) the importer can be configured with the following parameters:
file
fh
The 'type' parameter describes the MARC syntax variant. Supported values include:
ISO: Catmandu::Importer::MARC::ISO (default)
MicroLIF: Catmandu::Importer::MARC::MicroLIF
MARCMaker: Catmandu::Importer::MARC::MARCMaker
MiJ: Catmandu::Importer::MARC::MiJ (MARC in JSON)
XML: Catmandu::Importer::MARC::XML
RAW: Catmandu::Importer::MARC::RAW
Lint: Catmandu::Importer::MARC::Lint
ALEPHSEQ: Catmandu::Importer::MARC::ALEPHSEQ
E.g. catmandu convert MARC --type XML to MARC --type ISO < marc.xml > marc.iso
Catmandu::Exporter::MARC
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.