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       Opens a file for import. Ordinarily you will use "MARC::File::USMARC"
25       or "MARC::File::MicroLIF" to do this.
26
27           my $file = MARC::File::USMARC->in( 'file.marc' );
28
29       Returns a "MARC::File" object, or "undef" on failure. If you
30       encountered an error the error message will be stored in
31       $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       Reads the next record from the file handle passed in.
41
42       The $filter_func is a reference to a filtering function.  Currently,
43       only USMARC records support this.  See MARC::File::USMARC's "decode()"
44       function for details.
45
46       Returns a MARC::Record reference, or "undef" on error.
47
48   skip()
49       Skips over the next record in the file.  Same as "next()", without the
50       overhead of parsing a record you're going to throw away anyway.
51
52       Returns 1 or undef.
53
54   warnings()
55       Simlilar to the methods in MARC::Record and MARC::Batch, "warnings()"
56       will return any warnings that have accumulated while processing this
57       file; and as a side-effect will clear the warnings buffer.
58
59   close()
60       Closes the file, both from the object's point of view, and the actual
61       file.
62
63   write()
64       Writes a record to the output file.  This method must be overridden in
65       your subclass.
66
67   decode()
68       Decodes a record into a USMARC format.  This method must be overridden
69       in your subclass.
70
72       MARC::Record
73

TODO

75       ยท   "out()" method
76
77           We only handle files for input right now.
78

LICENSE

80       This code may be distributed under the same terms as Perl itself.
81
82       Please note that these modules are not products of or supported by the
83       employers of the various contributors to the code.
84

AUTHOR

86       Andy Lester, "<andy@petdance.com>"
87
88
89
90perl v5.12.0                      2005-04-22                     MARC::File(3)
Impressum