Scroll to navigation

MARC::Parser::RAW(3pm) User Contributed Perl Documentation MARC::Parser::RAW(3pm)
 

NAME

MARC::Parser::RAW - MARC RAW format parser

VERSION

version 0.01

SYNOPSIS

    use MARC::Parser::RAW;
    my $parser = MARC::Parser::RAW->new( $file );
    while ( my $record = $parser->next() ) {
        # do something        
    }

DESCRIPTION

MARC::Parser::RAW is a lightweight, fault tolerent parser for raw MARC records. Tags, indicators and subfield codes are not validated against the MARC standard. Record length from leader and field lengths from the directory are ignored. Records with a faulty structure will be skipped with a warning. The resulting data structure is optimized for usage with the Catmandu data tool kit.
MARC::Parser::RAW expects UTF-8 encoded files as input. Otherwise provide a filehande with a specified I/O layer or specify encoding.

MARC

The MARC record is parsed into an ARRAY of ARRAYs:
    $record = [
            [ 'LDR', undef, undef, '_', '00661nam  22002538a 4500' ],
            [ '001', undef, undef, '_', 'fol05865967 ' ],
            ...
            [   '245', '1', '0', 'a', 'Programming Perl /',
                'c', 'Larry Wall, Tom Christiansen & Jon Orwant.'
            ],
            ...
        ];

METHODS

new($file|$fh [, $encoding])

Configuration

"file"
Path to file with raw MARC records.
"fh"
Open filehandle for raw MARC records.
"fh"
Set encoding. Default: UTF-8. Optional.

next()

Reads the next record from MARC input stream. Returns a Perl hash.

_decode($record)

Deserialize a raw MARC record to an ARRAY of ARRAYs.

_field($field)

Split MARC field string in individual components.

SEEALSO

Catmandu, Catmandu::Importer::MARC.

Acknowledgement

The parser methods are adapted from Marc Chantreux's MARC::MIR module.

AUTHOR

Johann Rolschewski <rolschewski@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 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.
2014-05-28 perl v5.20.1