Print

Print


On Jan 14, 2014, at 3:01 PM, Eka Grguric wrote:

> Hi,
> 
> I am a complete newbie to Perl (and to Code4Lib) and am trying to set up a harvester to get complete metadata records from oai-pmh repositories. My current approach is to use things already built as much as possible - specifically the Net::Oai::Harvester (http://search.cpan.org/~esummers/OAI-Harvester-1.0/lib/Net/OAI/Harvester.pm). The code I'm using is located in the synopsis and specific parts of it seem to work with some samples I've tried. For example, if I submit a request for a list of sets to the oai url for arXiv.org (http://arXiv.org/oai2) I get the correct list.
> 
> The error I run into reads "can't call listRecords() on an undefined value in *filename* line *#*". listRecords() seems to have been an issue in past iterations but I'm not sure how to get around it. 
> 
> At the moment it looks like this: 
> ## list all the records in a repository
>     my $list = $harvester->listRecords(
> 		metadataPrefix = 'oai_dc'
> 	 );
> 
> Any help (or Perl resources) would be appreciated!

The error message you're getting is a sign that '$harvester' (the item that you tried calling 'listRecords' on) hasn't been set up properly.

The typical scenarios are that either the object was never called to be created or when you tried to create it the function returned undef (undefined value) to indicate that something had gone wrong.

How did you initialize it?

-Joe