NAME

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

SYNOPSIS

# On the command line

# Convert MARC to JSON (default)
$ catmandu convert MARC < /foo/bar.mrc

# Convert MARC to MARC
$ catmandu convert MARC to MARC < /foo/bar.mrc > /foo/output.mrc

# Add fixes
$ catmandu convert MARC to MARC --fix myfixes.txt < /foo/bar.mrc > /foo/output.mrc

# Create a list of titles
$ catmandu convert MARC to TSV --fix "marc_map(245,title); retain(title)" < /foo/bar.mrc

# Convert MARC XML
$ catmandu convert MARC --type XML < /foo/bar.xml

# Convert ALEPH sequential
$ catmandu convert MARC --type ALEPHSEQ < /foo/bar.aleph

# Convert on format to another format
$ catmandu convert MARC --type ISO to MARC --type ALEPHSEQ < /foo/bar.mrc > /foo/bar.aleph

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

file

Read input from a local file given by its path. Alternatively a scalar reference can be passed to read from a string.

fh

Read input from an IO::Handle. If not specified, Catmandu::Util::io is used to create the input stream from the file argument or by using STDIN.

fix

An ARRAY of one or more fixes or file scripts to be applied to imported items.

type

The MARC format to parse. The following MARC parsers are available:

ISO: L<Catmandu::Importer::MARC::ISO> (default) - a strict ISO 2709 parser
RAW: L<Catmandu::Importer::MARC::RAW> - a loose ISO 2709 parser that skips faulty records
ALEPHSEQ: L<Catmandu::Importer::MARC::ALEPHSEQ> - a parser for Ex Libris Aleph sequential files
Line: L<Catmandu::Importer::MARC::Line> - a parser for Index Data's MARC Line format
Lint: L<Catmandu::Importer::MARC::Lint> - a MARC syntax checker
MicroLIF: L<Catmandu::Importer::MARC::MicroLIF> - a parser for the MicroLIF format
MARCMaker: L<Catmandu::Importer::MARC::MARCMaker> - a parser for MARCMaker/MARCBreaker records
MiJ: L<Catmandu::Importer::MARC::MiJ> (MARC in JSON) - a parser for the MARC-in-JSON format
XML: L<Catmandu::Importer::MARC::XML> - a parser for the MARC XML format
skip_errors

If set, then any errors when parsing MARC input will be skipped and ignored. Use the debug setting of catmandu to view all error messages:

$ catmandu -D convert MARC --skip_errors 1 < /foo/bar.mrc
<other>

Every MARC importer can have its own options. Check the documentation of the specific importer.

SEE ALSO

Catmandu::Exporter::MARC