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

HTTP::OAI::Record - Encapsulates OAI record XML data

SYNOPSIS

        use HTTP::OAI::Record;

        # Create a new HTTP::OAI Record
        my $r = new HTTP::OAI::Record();

        $r->header->identifier('oai:myarchive.org:oid-233');
        $r->header->datestamp('2002-04-01');
        $r->header->setSpec('all:novels');

        $r->metadata(new HTTP::OAI::Metadata(dom=>$md));
        $r->about(new HTTP::OAI::About(dom=>$ab));

METHODS

$r = new HTTP::OAI::Record([header=>$header],[metadata=>$metadata],[about=>[$about]])

This constructor method returns a new HTTP::OAI::Record object. Optionally set the header, metadata, and add an about.

$h = $r->header([HTTP::OAI::Header])

Returns and optionally sets the record header (an HTTP::OAI::Header object).

$md = $r->metadata([HTTP::OAI::Metadata])

Returns and optionally sets the record metadata (an HTTP::OAI::Metadata object).

@about = $r->about([HTTP::OAI::About])

Optionally adds a new About record (an HTTP::OAI::About object) and returns a list of about returns.

NOTE

As an experimental feature HTTP::OAI::Record will accept a string for the header, metadata, and about fields (avoiding building an XML::DOM). When strings are used HTTP::OAI::Record does not support the toDOM functionality (you'll get errors).

The purpose behind this is to optimise repositories where headers/metadata/about may be stored as static XML, e.g.

        $res = new HTTP::OAI::ListRecords();

        $r = new HTTP::OAI::Record();

        $r->header($str);
        $r->metadata($str);
        $r->about($str);

        $res->record($r);

        my $dom = $res->toDOM(); # This will fail