1 # See ../README for a description of this program.
2 # perl -I../../blib/lib -I../../blib/arch zoomtst1.pl <target> <query>
9 print STDERR "Usage: $0 target query\n";
10 print STDERR " eg. $0 z3950.indexdata.dk/gils computer\n";
14 my($host, $query) = @ARGV;
16 # Database name defaults to "Default" in Net::Z3950 and must be overridden
19 my $conn = new Net::Z3950::Connection($host, 0, databaseName => $db)
20 or die "can't connect to '$host': $!";
22 # Default format is GRS-1 in Net::Z3950
23 $conn->option(preferredRecordSyntax => "usmarc");
25 # Default format is "B" in Net::Z3950
26 $conn->option(elementSetName => "F");
28 my $rs = $conn->search(-prefix => $query)
29 or die "can't search for '$query': ", $conn->errmsg();
31 print "Query '$query' found $n records\n";
33 # Note that the record-index is 1-based here, 0-based in ZOOM-C
35 my $rec = $rs->record($i)
36 or die "can't fetch record $i: ", $rs->errmsg();
37 print "=== Record $i of $n ===\n";
39 # Rendering format for MARC records is different
40 print $rec->render(), "\n";