NAME

Catmandu::Importer::MARC - Package that imports MARC data

SYNOPSIS

# From the command line
$ catmandu convert MARC --fix "marc_map('245a','title')" < /foo/bar.mrc

# From Perl
use Catmandu;

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

DESCRIPTION

Catmandu::Importer::MARC is a Catmandu::Iterable to import MARC records from an external source. When given an input file an Catmandu::Iterable is create generating items as perl HASH-es containing two keys:

'_id'    : the system identifier of the record (usually the 001 field) 
'record' : an ARRAY of ARRAYs containing the record data

Read more about processing data with Catmandu on the wiki: https://github.com/LibreCat/Catmandu/wiki

EXAMPLE ITEM

{
 'record' => [
                     [
                       '001',
                       undef,
                       undef,
                       '_',
                       'fol05882032 '
                     ],
                     [
                       '245',
                       '1',
                       '0',
                       'a',
                       'Cross-platform Perl /',
                       'c',
                       'Eric F. Johnson.'
                     ],
             ],
 '_id' => 'fol05882032'
}

METHODS

new(file => $filename, type => $type)

Create a new MARC importer for $filename. Use STDIN when no filename is given. Type describes the MARC parser to be used. Currently we support:

USMARC Catmandu::Importer::MARC::USMARC
MicroLIF Catmandu::Importer::MARC::MicroLIF
MARCMaker Catmandu::Importer::MARC::MARCMaker
JSON Catmandu::Importer::MARC::MiJ
XML Catmandu::Importer::MARC::XML
RAW Catmandu::Importer::MARC::RAW
Lint Catmandu::Importer::MARC::Lint
ALEPHSEQ Catmandu::Importer::MARC::ALEPHSEQ

Read the documentation of the parser modules for extra configuration options.

INHERTED METHODS

count

each(&callback)

...

Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited.

SEE ALSO

Catmandu::Importer, Catmandu::Iterable, Catmandu::Fix::marc_map , Catmandu::Fix::marc_xml