NAME
Catmandu::Importer::SRU - Package that imports SRU data
SYNOPSIS
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'
);
CONFIGURATION
- base
-
base URL of the SRU server (required)
- query
-
CQL query (required)
- recordSchema
-
set to
dc
by default - sortkeys
-
optional sorting
- operation
-
set to
searchRetrieve
by default - version
-
set to
1.1
by default. - userAgent
-
HTTP user agent, set to
Mozilla/5.0
by default. - furl
-
Instance of Furl or compatible class to fetch URLs with.
- parser
-
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 valueCatmandu::Importer::SRU::Parser
for an example.Name of a Perl package that implements a
parse
subroutine. The name must be prepended by+
or it prefixed withCatmandu::Importer::SRU::Parser::
. For instancemarcxml
will create aCatmandu::Importer::SRU::Parser::marcxml
.Function reference that gets passed the unparsed record.
METHODS
All methods of Catmandu::Importer and by this Catmandu::Iterable are inherited. In addition the following methods are provided:
url
Return the current SRU request URL (useful for debugging).
SEE ALSO
Catmandu::Importer, Catmandu::Iterable, http://www.loc.gov/standards/sru/