3 # $Id: zoomtst1.pl,v 1.6 2007-08-17 18:35:17 mike Exp $
5 # See ../README for a description of this program.
6 # perl -I../../blib/lib -I../../blib/arch zoomtst1.pl <target> <query>
12 if (@ARGV < 2 || @ARGV %2 == 1) {
13 print STDERR "Usage: $0 target query [<option> <value> ...]\n";
14 print STDERR " eg. $0 z3950.indexdata.dk/gils computer\n";
17 my $host = shift(@ARGV);
18 my $query = shift(@ARGV);
21 my $conn = new ZOOM::Connection($host, 0);
22 $conn->option(preferredRecordSyntax => "usmarc");
24 my $key = shift(@ARGV);
25 my $value = shift(@ARGV);
26 $conn->option($key => $value);
29 my $rs = $conn->search_pqf($query);
31 print "Query '$query' found $n records\n";
33 my $rec = $rs->record($i);
34 print "=== Record ", $i+1, " of $n ===\n";
41 die "Non-ZOOM error: $@" if !$@->isa("ZOOM::Exception");
42 print STDERR "Error ", $@->code(), ": ", $@->message();
43 print STDERR " (", $@->addinfo(), ")" if $@->addinfo();