PICA::Parser::Base(3)

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

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

annotate
    By default some parsers also support annotated PICA. Set to true to enforce field annotations or to false to forbid them.

METHODS

  new( [ $input | fh => $input ] [ %options ] )
Initialize parser to read from a given file, handle (e.g. IO::Handle), or reference to a Unicode string. PICA::Parser::XML also detects plain XML strings.

  next
Reads the next PICA+ record. Returns a PICA::Data object (that is a blessed hash with keys "record" and optional "_id").

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