1 # $Id: zoomtst1.pl,v 1.2 2005-10-12 14:35:46 mike Exp $
3 # See ../README for a description of this program.
4 # perl -I../../blib/lib -I../../blib/arch zoomtst1.pl <target> <query>
11 print STDERR "Usage: $0 target query\n";
12 print STDERR " eg. $0 bagel.indexdata.dk/gils computer\n";
16 my($host, $query) = @ARGV;
18 ### Database name defaults to "Default" in Net::Z3950 and must be overridden
21 my $conn = new Net::Z3950::Connection($host, 0, databaseName => $db)
22 or die "can't connect to '$host': $!";
24 ### Default format is GRS-1 in Net::Z3950
25 $conn->option(preferredRecordSyntax => "usmarc");
27 ### Default format is "B" in Net::Z3950
28 $conn->option(elementSetName => "F");
30 my $rs = $conn->search(-prefix => $query)
31 or die "can't search for '$query': ", $conn->errmsg();
33 print "Query '$query' found $n records\n";
35 ### Note that the record-index is 1-based here, 0-based in ZOOM-C
37 my $rec = $rs->record($i)
38 or die "can't fetch record $i: ", $rs->errmsg();
39 print "=== Record $i of $n ===\n";
41 ### Rendering format for MARC records is different
42 print $rec->render(), "\n";