The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

PICA::Parser::Base - abstract base class of PICA parsers

SYNOPSIS

use PICA::Parser::Plain;
my $parser = PICA::Parser::Plain->new( $filename );

while ( my $record = $parser->next ) {
    # do something
}

use PICA::Parser::Plus;
my $parser = PICA::Parser::Plus->new( $filename, bless => 1 );
... # records will be instances of PICA::Data

use PICA::Parser::XML;
my $parser = PICA::Parser::XML->new( $filename, start => 1 );
...

DESCRIPTION

This abstract base class of PICA+ parsers should not be instantiated directly. Use one of the following subclasses instead:

PICA::Parser::Plain
PICA::Parser::Plus
PICA::Parser::Binary
PICA::Parser::XML
PICA::Parser::PPXML
PICA::Parser::JSON

CONFIGURATION

blessed

Return records as instances of PICA::Data (disabled by default).

strict

By default faulty fields in records are skipped with warnings. You can make them fatal by setting the strict parameter to 1.

METHODS

new( [ $input | fh => $input ] [ %options ] )

Initialize parser to read from a given file, handle (e.g. IO::Handle), or string reference. PICA::Parser::XML also detects plain XML strings.

next

Reads the next PICA+ record. Returns a (optionally blessed) hash with keys _id and record, as defined in PICA::Data.

SEE ALSO

See Catmandu::Importer::PICA for usage of this module in Catmandu.

Alternative PICA parsers had been implemented as PICA::PlainParser and PICA::XMLParser and included in the release of PICA::Record (DEPRECATED).