NAME
Catmandu::Importer::OAI - Package that imports OAI-PMH feeds
SYNOPSIS
use Catmandu::Importer::OAI;
my $importer = Catmandu::Importer::OAI->new(
url => "...",
metadataPrefix => "..." ,
from => "..." ,
until => "..." ,
set => "...",
handler => "..." );
my $n = $importer->each(sub {
my $hashref = $_[0];
# ...
});
CONFIGURATION
- url
- metadataPrefix
- handler
- set
- from
- until
- listIdentifiers
-
Harvest identifiers instead of full records.
- dry
-
Don't do any HTTP requests but return URLs that data would be queried from.
DESCRIPTION
Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. The Catmandu::Importer::OAI methods are not idempotent: OAI-PMH feeds can only be read once.
To parse metadata records into Perl hashes optionally a handler can be provided. This is a Perl package that implements two methods:
* metadataPrefix - which should return a metadataPrefix string for which it can parse
the metadata
* parse($dom) - which recieves a XML::LibXML::DOM object and should return a Perl hash
E.g.
package MyHandler;
use Moo;
has metadataPrefix => (is => 'ro' , default => sub { "oai_dc" });
sub parse {
my ($self,$dom) = @_;
return {};
}