View on
MetaCPAN
Patrick Hochstenbach > Catmandu-MARC > Catmandu::Importer::MARC

Download:
Catmandu-MARC-1.09.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 1.09   Source  

NAME ^

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

SYNOPSIS ^

    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

DESCRIPTION ^

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

EXAMPLE ITEM ^

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

METHODS ^

This module inherits all methods of Catmandu::Importer and by this Catmandu::Iterable.

CONFIGURATION ^

In addition to the configuration provided by Catmandu::Importer (file, fh, etc.) the importer can be configured with the following parameters:

The 'type' parameter describes the MARC syntax variant. Supported values include:

    E.g.

    catmandu convert MARC --type XML to MARC --type ISO < marc.xml > marc.iso

SEE ALSO ^

Catmandu::Exporter::MARC

syntax highlighting: