Catmandu::Importer::OAI - Package that imports OAI-PMH feeds
use Catmandu::Importer::OAI; my $importer = Catmandu::Importer::OAI->new( url => "...", metadataPrefix => "..." , from => "..." , until => "..." , set => "...", handler => "..." ); my $n = $importer->each(sub { my $hashref = $_[0]; # ... });
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 {}; }
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.
Catmandu::Iterable
To install Catmandu::OAI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu::OAI
CPAN shell
perl -MCPAN -e shell install Catmandu::OAI
For more information on module installation, please visit the detailed CPAN module installation guide.