The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

VERSION

version 0.04

SYNOPSIS

    use Catmandu::Importer::MAB2;

    my $importer = Catmandu::Importer::MAB2->new(file => "./t/mab2.dat", type=> "RAW");

    my $n = $importer->each(sub {
        my $hashref = $_[0];
        # ...
    });

NAME

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

Arguments

file

Path to file with MAB2 records.

fh

Open filehandle for file with MAB2 records.

id

Specify MAB2 field tag to get record identifier from. Default: 001. Optional.

type

Specify type of MAB2 records: Disk (Diskette), RAW (Band), XML. Default: RAW. Optional.

MAB2

The parsed MAB2 record 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',
                    ' ',
                    '_',
                    'fol05882032 '
                ],
                [
                    245,
                    'a',
                    'a',
                    'Cross-platform Perl /',
                    'c',
                    'Eric F. Johnson.'
                ],
        ],
  '_id' => 'fol05882032'
 } 

METHODS

new(file => $filename | fh => $filehandle [,type => $type, id => $field_tag])

Create a new MAB2 importer for $filename. Use STDIN when no filename is given.

count

each(&callback)

...

Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. The Catmandu::Importer::MAB methods are not idempotent: MAB feeds can only be read once.

SEE ALSO

Catmandu::Importer, Catmandu::Iterable;

AUTHOR

Johann Rolschewski <rolschewski@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Johann Rolschewski.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.