| 1 |
NAME |
| 2 |
|
| 3 |
MARC::Parser::RAW - Parser for ISO 2709 encoded MARC records |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
|
| 7 |
use MARC::Parser::RAW; |
| 8 |
|
| 9 |
my $parser = MARC::Parser::RAW->new( $file ); |
| 10 |
|
| 11 |
while ( my $record = $parser->next() ) { |
| 12 |
# do something |
| 13 |
} |
| 14 |
|
| 15 |
DESCRIPTION |
| 16 |
|
| 17 |
MARC::Parser::RAW is a lightweight, fault tolerant parser for ISO 2709 |
| 18 |
encoded MARC records. Tags, indicators and subfield codes are not |
| 19 |
validated against the MARC standard. Record length from leader and |
| 20 |
field lengths from the directory are ignored. Records with a faulty |
| 21 |
structure will be skipped with a warning. The resulting data structure |
| 22 |
is optimized for usage with the Catmandu data tool kit. |
| 23 |
|
| 24 |
MARC::Parser::RAW expects UTF-8 encoded files as input. Otherwise |
| 25 |
provide a filehande with a specified I/O layer or specify encoding. |
| 26 |
|
| 27 |
MARC |
| 28 |
|
| 29 |
The MARC record is parsed into an ARRAY of ARRAYs: |
| 30 |
|
| 31 |
$record = [ |
| 32 |
[ 'LDR', undef, undef, '_', '00661nam 22002538a 4500' ], |
| 33 |
[ '001', undef, undef, '_', 'fol05865967 ' ], |
| 34 |
... |
| 35 |
[ '245', '1', '0', 'a', 'Programming Perl /', |
| 36 |
'c', 'Larry Wall, Tom Christiansen & Jon Orwant.' |
| 37 |
], |
| 38 |
... |
| 39 |
]; |
| 40 |
|
| 41 |
METHODS |
| 42 |
|
| 43 |
new($file|$fh|$scalarref [, $encoding]) |
| 44 |
|
| 45 |
Configuration |
| 46 |
|
| 47 |
file |
| 48 |
|
| 49 |
Path to file with raw MARC records. |
| 50 |
|
| 51 |
fh |
| 52 |
|
| 53 |
Open filehandle for raw MARC records. |
| 54 |
|
| 55 |
scalarref |
| 56 |
|
| 57 |
Reference to scalar with raw MARC records. |
| 58 |
|
| 59 |
encoding |
| 60 |
|
| 61 |
Set encoding. Default: UTF-8. Optional. |
| 62 |
|
| 63 |
next() |
| 64 |
|
| 65 |
Reads the next record from MARC input stream. Returns a Perl hash. |
| 66 |
|
| 67 |
_decode($record) |
| 68 |
|
| 69 |
Deserialize a raw MARC record to an ARRAY of ARRAYs. |
| 70 |
|
| 71 |
_field($field) |
| 72 |
|
| 73 |
Split MARC field string in individual components. |
| 74 |
|
| 75 |
AUTHOR |
| 76 |
|
| 77 |
Johann Rolschewski <[email protected]> |
| 78 |
|
| 79 |
COPYRIGHT |
| 80 |
|
| 81 |
Copyright 2014- Johann Rolschewski |
| 82 |
|
| 83 |
LICENSE |
| 84 |
|
| 85 |
This library is free software; you can redistribute it and/or modify it |
| 86 |
under the same terms as Perl itself. |
| 87 |
|
| 88 |
SEEALSO |
| 89 |
|
| 90 |
Catmandu, Catmandu::Importer::MARC. |
| 91 |
|
| 92 |
ACKNOWLEDGEMENT |
| 93 |
|
| 94 |
The parser methods are adapted from Marc Chantreux's MARC::MIR module. |
| 95 |
|