Catmandu::Importer::SRU - Package that imports SRU data
use Catmandu::Importer::SRU; my %attrs = ( base => 'http://www.unicat.be/sru', query => '(isbn=0855275103 or isbn=3110035170 or isbn=9010017362 or isbn=9014026188)', recordSchema => 'marcxml', parser => 'marcxml' ); my $importer = Catmandu::Importer::SRU->new(%attrs); my $count = $importer->each(sub { my $schema = $record->{recordSchema}; my $packing = $record->{recordPacking}; my $position = $record->{recordPosition}; my $data = $record->{recordData}; # ... }); # Using Catmandu::Importer::SRU::Package::marcxml, included in this release my $importer = Catmandu::Importer::SRU->new( base => 'http://www.unicat.be/sru', query => '(isbn=0855275103 or isbn=3110035170 or isbn=9010017362 or isbn=9014026188)', recordSchema => 'marcxml' , parser => 'marcxml' , ); # Using a homemade parser my $importer = Catmandu::Importer::SRU->new( base => 'http://www.unicat.be/sru', query => '(isbn=0855275103 or isbn=3110035170 or isbn=9010017362 or isbn=9014026188)', recordSchema => 'marcxml' , parser => MyParser->new , # or parser => '+MyParser' );
This Catmandu::Importer imports records via SRU.
SRU diagnostics are emitted as warnings except for parser set to meta.
meta
Base URL of the SRU server (required)
CQL query (required)
Number of records to fetch in one batch, set to 10 by default. This is translated to SRU request parameter maximumRecords.
10
maximumRecords
Records are fetched in multiple batches of this size or less.
Total number of records this importer may return.
Not set by default
Set to dc by default
dc
Optional sorting
Set to searchRetrieve by default
searchRetrieve
Set to 1.1 by default
1.1
HTTP user agent, set to Mozilla/5.0 by default.
Mozilla/5.0
Instance of HTTP::Tiny or compatible class to fetch URLs with.
Controls how records are parsed before importing. The following options are possible:
Instance of a Perl package that implements a parse subroutine. See the default value Catmandu::Importer::SRU::Parser for an example.
parse
Catmandu::Importer::SRU::Parser
Name of a Perl package that implements a parse subroutine. The name must be prepended by + or it prefixed with Catmandu::Importer::SRU::Parser::. For instance marcxml will create a Catmandu::Importer::SRU::Parser::marcxml.
+
Catmandu::Importer::SRU::Parser::
marcxml
Catmandu::Importer::SRU::Parser::marcxml
Function reference that gets passed the unparsed record.
All methods of Catmandu::Importer and by this Catmandu::Iterable are inherited. In addition the following methods are provided:
Return the current SRU request URL (useful for debugging).
Catmandu::Importer, Catmandu::Iterable, http://www.loc.gov/standards/sru/
To install Catmandu::SRU, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu::SRU
CPAN shell
perl -MCPAN -e shell install Catmandu::SRU
For more information on module installation, please visit the detailed CPAN module installation guide.