New
[ZOOM-Perl-moved-to-github.git] / samples / zoom / zoomtst1.pl
1 # $Id: zoomtst1.pl,v 1.1 2005-10-12 11:53:27 mike Exp $
2 #
3 # See ../README for a description of this program.
4 # perl -I../../blib/lib -I../../blib/arch zoomtst1.pl <target> <query>
5
6 use strict;
7 use warnings;
8 use ZOOM;
9
10 if (@ARGV != 2) {
11     print STDERR "Usage: $0 target query\n";
12     print STDERR "      eg. $0 bagel.indexdata.dk/gils computer\n";
13     exit 1;
14 }
15
16 my($host, $query) = @ARGV;
17 my $conn = new ZOOM::Connection($host, 0);
18 $conn->option(preferredRecordSyntax => "usmarc");
19 my $rs = $conn->search_pqf($query);
20 my $n = $rs->size();
21 for my $i (0..$n-1) {
22     my $rec = $rs->record($i);
23     print "=== Record ", $i+1, " of $n ===\n";
24     print $rec->render();
25 }
26
27 $rs->destroy();
28 $conn->destroy();