NAME
    PICA::Data - PICA record processing

SYNOPSIS
        use PICA::Data ':all';
        $parser = pica_parser( xml => @options );
        $writer = pica_writer( plain => @options );
   
        use PICA::Parser::XML;
        use PICA::Writer::Plain;
        $parser = PICA::Parser::XML->new( @options );
        $writer = PICA::Writer::Plain->new( @options );

        while ( my $record = $parser->next ) {
            my $ppn      = pica_value($record, '003@0'); # == $record->{_id}
            my $holdings = pica_holdings($record);
            my $items    = pica_holdings($record);
            ...
        }
  
        # parse single record from string
        my $record = pica_parser('plain', \"...")->next;

DESCRIPTION
    PICA::Data provides methods, classes, and functions to process PICA+
    records in Perl.

    PICA+ is the internal data format of the Local Library System (LBS) and
    the Central Library System (CBS) of OCLC, formerly PICA. Similar library
    formats are the MAchine Readable Cataloging format (MARC) and the
    Maschinelles Austauschformat fuer Bibliotheken (MAB). In addition to
    PICA+ in CBS there is the cataloging format Pica3 which can losslessly
    be convert to PICA+ and vice versa.

    Records in PICA::Data are encoded either as as array of arrays, the
    inner arrays representing PICA fields, or as an object with two fields,
    "_id" and "record", the latter holding the record as array of arrays,
    and the former holding the record identifier, stored in field "003@",
    subfield 0. For instance a minimal record with just one field "003@":

        {
          _id    => '12345X',
          record => [
            [ '003@', undef, '0' => '12345X' ]
          ]
        }

    or in short form:

        [ [ '003@', undef, '0' => '12345X' ] ]

    PICA path expressions can be used to facilitate processing PICA+
    records.

CONSTRUCTORS
  pica_parser( $type [, @options] )
    Create a PICA parsers object. Case of the type is ignored and additional
    parameters are passed to the parser's constructor.

    *   PICA::Parser::XML for type "xml" or "picaxml" (PICA-XML)

    *   PICA::Parser::Plus for type "plus" or "picaplus" (normalized PICA+)

    *   PICA::Parser::Plain for type "plain" or "picaplain" (human-readable
        PICA+)

  pica_writer( $type [, @options] )
    Create a PICA writer object in the same way as "pica_parser" with one of

    *   PICA::Writer::XML for type "xml" or "picaxml" (PICA-XML)

    *   PICA::Writer::Plus for type "plus" or "picaplus" (normalized PICA+)

    *   PICA::Writer::Plain for type "plain" or "picaplain" (human-readable
        PICA+)

  pica_path( $path )
    Equivalent to "PICA::Path->new($path)".

ACCESSORS
    The following function can also be called as method on a blessed
    PICA::Data record by stripping the "pica_..." prefix:

        bless $record, 'PICA::Data';
        $record->values($path);
        $record->items;
        ...

  pica_values( $record, $path )
    Extract a list of subfield values from a PICA record based on a PICA
    path expression.

  pica_value( $record, $path )
    Same as "pica_values" but only returns the first value. Can also be
    called as "value" on a blessed PICA::Data record.

  pica_fields( $record, $path )
    Returns a PICA record limited to fields specified in a PICA path
    expression. Always returns an array reference. Can also be called as
    "fields" on a blessed PICA::Data record.

  pica_holdings( $record )
    Returns a list (as array reference) of local holding records (level 1
    and 2), where the "_id" of each record contains the ILN (subfield
    "101@a").

  pica_items( $record )
    Returns a list (as array reference) of item records (level 1), where the
    "_id" of each record contains the EPN (subfield "203@/**0").

CONTRIBUTORS
    Johann Rolschewski, "<rolschewski@gmail.com>"

    Jakob Voss "<voss@gbv.de>"

COPYRIGHT
    Copyright 2014- Johann Rolschewski and Jakob Voss

LICENSE
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

SEE ALSO
    Use Catmandu::PICA for processing PICA records with the Catmandu
    toolkit, for instance to convert PICA XML to plain PICA+:

       catmandu convert PICA --type xml to PICA --type plain < picadata.xml

    PICA::Record implements an alternative framework for processing PICA+
    records but development of the module is stalled.