NAME
PICA::PlainParser - Parse normalized PICA+
SYNOPSIS
my $parser = PICA::PlainParser->new(
Field => \&field_handler,
Record => \&record_handler
);
$parser->parsefile($filename);
sub field_handler {
my $field = shift;
print $field->to_string();
# no need to save the field so do not return it
}
sub record_handler {
print "\n";
}
DESCRIPTION
This module contains a parser for normalized PICA+
PUBLIC METHODS
new (params)
Create a new parser. See PICA::Parser for a detailed description of the possible parameters Field
, Record
, and Collection
. Additionally you may specify the parameter EmptyRecords
to define that empty records will not be skipped but passed to the record handler and Strict
to abort when an error occured. Default behaviour is not strict: errors are reported to STDERR.
parsefile
Parses a file, specified by a filename or file handle. Additional possible parameters are handlers (Field
, Record
, Collection
) and options (Strict
, EmptyRecords
). If you supply a filename with extension .gz
then it is extracted while reading with zcat
.
parsedata
Parses PICA+ data from a string, array or function. If you supply a function then this function is must return scalars or arrays and it is called unless it returns undef.
counter
Get the number of read records so far.
empty_counter
Get the number of empty records that have been read so far. By default empty records are not passed to the record handler but counted.
PRIVATE METHODS
_parsedata
Parses a string or an array reference.
_parseline
Parses a line (without trailing newline character). May throw an exception with croak.
handle_record
Calls the record handler.
AUTHOR
Jakob Voss <jakob.voss@gbv.de>
LICENSE
Copyright (C) 2007 by Verbundzentrale Göttingen (VZG) and Jakob Voss
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
Please note that these module s not product of or supported by the employers of the various contributors to the code nor by OCLC PICA.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 277:
Non-ASCII character seen before =encoding in 'Göttingen'. Assuming UTF-8