File: README

package info (click to toggle)
libmarc-parser-raw-perl 0.06-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 152 kB
  • sloc: perl: 113; sh: 6; makefile: 2
file content (95 lines) | stat: -rw-r--r-- 2,179 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
NAME

    MARC::Parser::RAW - Parser for ISO 2709 encoded MARC records

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 tolerant parser for ISO 2709
    encoded 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|$scalarref [, $encoding])

  Configuration

    file

      Path to file with raw MARC records.

    fh

      Open filehandle for raw MARC records.

    scalarref

      Reference to scalar with raw MARC records.

    encoding

      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.

AUTHOR

    Johann Rolschewski <jorol@cpan.org>

COPYRIGHT

    Copyright 2014- Johann Rolschewski

LICENSE

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

SEEALSO

    Catmandu, Catmandu::Importer::MARC.

ACKNOWLEDGEMENT

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