Skip to content

Instantly share code, notes, and snippets.

@egrguric
Created January 16, 2014 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egrguric/8447275 to your computer and use it in GitHub Desktop.
Save egrguric/8447275 to your computer and use it in GitHub Desktop.
## create a harvester for the BCIT Repository
#!/usr/bin/perl
use warnings;
use strict;
use Net::OAI::Harvester;
my $harvester = Net::OAI::Harvester->new(
baseURL => 'http://contentpro.lib.bcit.ca/iii/oairep/OAIRepository'
);
# find out the name for a repository
my $identity = $harvester->identify();
print "name: ",$identity->repositoryName(),"\n";
print "protocol vesion: ",$identity->protocolVersion(),"\n";
print "earliest date stamp: ",$identity->earliestDatestamp(),"\n";
my $list = $harvester->listMetadataFormats();
print "archive supports metadata prefixes: ",
join( ',', $list->prefixes() ), "\n";
# get a list of identifiers
my $identifiers = $harvester->listIdentifiers(
'metadataPrefix' => 'oai_dc',
'metadataPrefix'=> 'qdc');
while ( my $header = $identifiers->next() ) {
print "identifier: ",$header->identifier(), "\n";
}
# list all the records in a repository
my $records = $harvester->listAllRecords(
'metadataPrefix' => 'oai_dc');
while ( my $record = $records->next() ) {
my $header = $record->header();
my $metadata = $record->metadata();
print "identifier: ", $header->identifier(), "\n";
print "title: ", $metadata->title(), "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment