1MARC::File(3)         User Contributed Perl Documentation        MARC::File(3)
2
3
4

NAME

6       MARC::File - Base class for files of MARC records
7

SYNOPSIS

9           use MARC::File::USMARC;
10
11           my $file = MARC::File::USMARC->in( $filename );
12
13           while ( my $marc = $file->next() ) {
14               # Do something
15           }
16           $file->close();
17           undef $file;
18

EXPORT

20       None.
21

METHODS

23       in()
24
25       Opens a file for import. Ordinarily you will use "MARC::File::USMARC"
26       or "MARC::File::MicroLIF" to do this.
27
28           my $file = MARC::File::USMARC->in( 'file.marc' );
29
30       Returns a "MARC::File" object, or "undef" on failure. If you encoun‐
31       tered an error the error message will be stored in $MARC::File::ERROR.
32
33       Optionally you can also pass in a filehandle, and "MARC::File".  will
34       "do the right thing".
35
36           my $handle = IO::File->new( 'gunzip -c file.marc.gz ⎪' );
37           my $file = MARC::File::USMARC->in( $handle );
38
39       next( [\&filter_func] )
40
41       Reads the next record from the file handle passed in.
42
43       The $filter_func is a reference to a filtering function.  Currently,
44       only USMARC records support this.  See MARC::File::USMARC's "decode()"
45       function for details.
46
47       Returns a MARC::Record reference, or "undef" on error.
48
49       skip()
50
51       Skips over the next record in the file.  Same as "next()", without the
52       overhead of parsing a record you're going to throw away anyway.
53
54       Returns 1 or undef.
55
56       warnings()
57
58       Simlilar to the methods in MARC::Record and MARC::Batch, "warnings()"
59       will return any warnings that have accumulated while processing this
60       file; and as a side-effect will clear the warnings buffer.
61
62       close()
63
64       Closes the file, both from the object's point of view, and the actual
65       file.
66
67       write()
68
69       Writes a record to the output file.  This method must be overridden in
70       your subclass.
71
72       decode()
73
74       Decodes a record into a USMARC format.  This method must be overridden
75       in your subclass.
76
78       MARC::Record
79

TODO

81       * "out()" method
82           We only handle files for input right now.
83

LICENSE

85       This code may be distributed under the same terms as Perl itself.
86
87       Please note that these modules are not products of or supported by the
88       employers of the various contributors to the code.
89

AUTHOR

91       Andy Lester, "<andy@petdance.com>"
92
93
94
95perl v5.8.8                       2005-04-27                     MARC::File(3)
Impressum