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

METHODS

new(url => URL, %options)

Create a new OAI-PMH importer for the URL. Optionally provide OAI-PMH parameters: metadataPrefix, from, until and set. 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 {};
}

count

each(&callback)

...

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.

SEE ALSO

Catmandu::Iterable