1HTTP::OAI::Repository(3Upsme)r Contributed Perl DocumentaHtTiToPn::OAI::Repository(3pm)
2
3
4

NAME

6       HTTP::OAI::Repository - Documentation for building an OAI compliant
7       repository using OAI-PERL
8

DESCRIPTION

10       Using the OAI-PERL library in a repository context requires the user to
11       build the OAI responses to be sent to OAI harvesters.
12

SYNOPSIS 1

14               use HTTP::OAI::Harvester;
15               use HTTP::OAI::Metadata::OAI_DC;
16               use XML::SAX::Writer;
17               use XML::LibXML;
18
19               # (all of these options _must_ be supplied to comply with the OAI protocol)
20               # (protocolVersion and responseDate both have sensible defaults)
21               my $r = new HTTP::OAI::Identify(
22                       baseURL=>'http://yourhost/cgi/oai',
23                       adminEmail=>'youremail@yourhost',
24                       repositoryName=>'agoodname',
25                       requestURL=>self_url()
26               );
27
28               # Include a description (an XML::LibXML Dom object)
29               $r->description(new HTTP::OAI::Metadata(dom=>$dom));
30
31               my $r = HTTP::OAI::Record->new(
32                       header=>HTTP::OAI::Header->new(
33                               identifier=>'oai:myrepo:10',
34                               datestamp=>'2004-10-01'
35                               ),
36                       metadata=>HTTP::OAI::Metadata::OAI_DC->new(
37                               dc=>{title=>['Hello, World!'],description=>['My Record']}
38                               )
39               );
40               $r->about(HTTP::OAI::Metadata->new(dom=>$dom));
41
42               my $output;
43               my $w = XML::SAX::Writer->new(Output=>\$output);
44
45               my $driver = HTTP::OAI::SAX::Driver->new(
46                               Handler => my $builder = XML::LibXML::SAX::Builder->new()
47                       );
48
49               $driver->start_oai_pmh();
50               $r->set_handler($w);
51               $r->generate($driver);
52               $driver->end_oai_pmh();
53
54               my $xml = $builder->result;
55

Building an OAI compliant repository

57       The validation scripts included in this module provide the repository
58       admin with a number of tools for helping with being OAI compliant,
59       however they can not be exhaustive in themselves.
60

METHODS

62       $r = HTTP::OAI::Repository::validate_request(%paramlist)
63       $r = HTTP::OAI::Repository::validate_request_2_0(%paramlist)
64           These functions, exported by the Repository module, validate an OAI
65           request against the protocol requirements. Returns an
66           HTTP::Response object, with the code set to 200 if the request is
67           well-formed, or an error code and the message set.
68
69           e.g:
70
71                   my $r = validate_request(%paramlist);
72
73                   print header(-status=>$r->code.' '.$r->message),
74                           $r->error_as_HTML;
75
76           Note that validate_request attempts to be as strict to the Protocol
77           as possible.
78
79       $b = HTTP::OAI::Repository::validate_date($date)
80       $b = HTTP::OAI::Repository::validate_metadataPrefix($mdp)
81       $b = HTTP::OAI::Repository::validate_responseDate($date)
82       $b = HTTP::OAI::Repository::validate_setSpec($set)
83           These functions, exported by the Repository module, validate the
84           given type of OAI data. Returns true if the given value is sane,
85           false otherwise.
86

EXAMPLE

88       See the bin/gateway.pl for an example implementation (it's actually for
89       creating a static repository gateway, but you get the idea!).
90
91
92
93perl v5.32.0                      2020-07-28        HTTP::OAI::Repository(3pm)
Impressum