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::XML

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. The common option blessed (disabled by default) can be used to return records as instances of PICA::Data.

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).