stop with the error mesage: "Unspecified error at test.pl line 29" line 29 is : my $rec = $rs->record(1) The original code was: for (my $i = 1; $i <= $n; $i++) { my $rec = $rs->record($i) or die $rs->errmsg(); my $m = MARC::Record->new_from_usmarc($rec->rawdata()); print $m->subfield('650',"a"), "\n";
To get only one entry I got rid of the for loop: my $rec = $rs->record(1) or die $rs->errmsg(); my $m = MARC::Record->new_from_usmarc($rec->rawdata()); print "$issn\t"; print $m->subfield('650',"a"), "\n"; Any idea? Thanks. --sharif Sharif Islam wrote:
I have this simple scripts that looks up ISSN and returns the subject. Why it is returning two records for the same ISSN?use strict; use Net::Z3950; use MARC::Record; use MARC::File::USMARC; use MARC::Field;my $conn = new Net::Z3950::Connection('z3950.loc.gov', 7090,databaseName => 'Voyager');my $issn="0896-9205"; my $query = '@attr 1=8 ' . $issn; $conn->option(preferredRecordSyntax => "USMARC", elementSetName => 'b'); my $rs = $conn->search($query) or die $conn->errmsg(); my $n = $rs->size(); print "found $n records\n"; for (my $i = 1; $i <= $n; $i++) { my $rec = $rs->record($i) or die $rs->errmsg(); my $m = MARC::Record->new_from_usmarc($rec->rawdata()); print $m->subfield('650',"a"), "\n"; #print $rec->render(); } # perl test.pl found 2 records Sociology Sociology
-- Sharif Islam Research Programmer Library Systems Office University of Illinois Urbana-Champaign http://www.library.uiuc.edu phone: (217) 244-4688
smime.p7s
Description: S/MIME Cryptographic Signature