From: mike Date: Wed, 15 Aug 2007 18:36:36 +0000 (+0000) Subject: New X-Git-Tag: cpan_1_22~48 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=f7bb82c404e1f71d75745b01da307039df8b2fba;p=ZOOM-Perl-moved-to-github.git New --- diff --git a/samples/zoom/zoomscan.pl b/samples/zoom/zoomscan.pl new file mode 100644 index 0000000..dcdb90d --- /dev/null +++ b/samples/zoom/zoomscan.pl @@ -0,0 +1,35 @@ +# $Id: zoomscan.pl,v 1.1 2007-08-15 18:36:36 mike Exp $ +# +# This is the scanning counterpart to zoomscan.pl's searching +# perl -I../../blib/lib -I../../blib/arch zoomscan.pl + +use strict; +use warnings; +use ZOOM; + +if (@ARGV != 2) { + print STDERR "Usage: $0 target scanQuery\n"; + print STDERR " eg. $0 z3950.indexdata.dk/gils computer\n"; + exit 1; +} +my($host, $scanQuery) = @ARGV; + +eval { + my $conn = new ZOOM::Connection($host, 0); + $conn->option(preferredRecordSyntax => "usmarc"); + my $ss = $conn->scan_pqf($scanQuery); + my $n = $ss->size(); + for my $i (0..$n-1) { + my($term, $occ) = $ss->term($i); + print $i+1, ": $term"; + print " ($occ)" if defined $occ; + print "\n"; + } + + $ss->destroy(); + $conn->destroy(); +}; if ($@) { + die "Non-ZOOM error: $@" if !$@->isa("ZOOM::Exception"); + print STDERR "ZOOM error $@\n"; + exit 1; +}