It is designed to hit the Library of Congress z3950 server. The server will return a marc record if the isbn number is found. If the isbn isn't found the number is placed into an error file. Many modern books have the isbn number bar-coded on the back cover. You can simply scan the barcodes into a text file and use the script below.
This script was built using perl v 5.8.8 using Net::Z3950::ZOOM.
It updateshttps://drtc.isibang.ac.in
search the database for isbn
a sample isbn text file produced by scanning the barcode found on some books
#!/usr/bin/perl use ZOOM; open(INFILE, "/home/mike2/Desktop/isbn.txt"); @query = <INFILE>; close INFILE; $totalisbns = @query; $totalfound = 0; open FILE, ">/home/mike2/Desktop/goodstuff.txt"; open ERRFILE, ">/home/mike2/Desktop/isbnbad.txt"; # Establish connection $conn = new ZOOM::Connection('z3950.loc.gov', 7090, databaseName => 'Voyager') or die "Can not connect $!"; #$conn->option(querytype => 'ccl2rpn'); #$conn->option(elementSetName => "f"); $conn->option(preferredRecordSyntax => "USMARC"); # Take each query from ISBN file foreach $q (@query) { chomp($q); #$q = s/^/isbn=/; $rs = $conn->search_pqf($q); #$rs = $conn->search($q); if($rs->size()==0) { print "Could not find ISBN: ", $q, "\n"; print ERRFILE $q, "\n"; #$conn->close(); # You can change the IP address, Port number and database name # in the following line #$conn = new::ZOOM::Connection('Z3950.loc.gov', 7090, #databaseName => 'voyager') #or die "Can not connect $!" ; #$conn->option(querytype => 'ccl2rpn'); #$conn->option(elementSetName => "f"); #$conn->option(preferredRecordSyntax => #"USMARC"); } else { print "Getting Record for ISBN: ", $q, "\n"; #$rec = $rs->record(1); #$record = $rec->rawdata(); $rec = $rs->record(0); if($record = /^Failed/) { print "Found ", $rs->size(), "records, BUT ", $record, "\n"; print "adding ", $q, " to not found list\n"; print ERRFILE $q, "\n"; next; } $totalfound++; # Uncomment the following line, if you do not want CDS/ISIS export #format # print OUTFILE $record; # Comment the following upto 'end of for' if you do not want CDS/ISIS #format #$len = length($record); #for($i=0; $i < $len; $i=$i+80) #{ #$s = substr($record, $i, 80); #$recsep = chr(29); #$fldsep = chr(30); #$subsep = chr(31); #$s = s/$recsep/#/g; #$s = s/$fldsep/#/g; #$s = s/$subsep/^/g; #print OUTFILE "$s\n"; #} # end of for #} #end of else #} # end of foreach print FILE $rec->raw(); print "Total $totalfound / $totalisbns reocrds printed\n"; close OUTFILE; close ERRFILE }}
Also here. Creator: Michael Reavey, mrmrmr50 at rediff.com