Nicolas Steenlant > Catmandu-MARC-0.103 > Catmandu::Importer::MARC

Download:
Catmandu-MARC-0.103.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  1
View/Report Bugs
Source   Latest Release: Catmandu-MARC-0.205

NAME ^

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

SYNOPSIS ^

    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;

MARC ^

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'
 }

METHODS ^

new(file => $filename, type => $type, $records => $records, [id=>$id_field])

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).

count

each(&callback)

...

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.

SEE ALSO ^

Catmandu::Iterable

syntax highlighting: