projects
/
ZOOM-Perl-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ALlow arbitrary options to be specified at end of command-line.
[ZOOM-Perl-moved-to-github.git]
/
samples
/
zoom
/
zoomtst1.pl
diff --git
a/samples/zoom/zoomtst1.pl
b/samples/zoom/zoomtst1.pl
index
2e3e0b3
..
c2b7f56
100644
(file)
--- a/
samples/zoom/zoomtst1.pl
+++ b/
samples/zoom/zoomtst1.pl
@@
-1,4
+1,4
@@
-# $Id: zoomtst1.pl,v 1.4 2006-11-02 17:48:26 mike Exp $
+# $Id: zoomtst1.pl,v 1.5 2007-08-17 11:08:38 mike Exp $
#
# See ../README for a description of this program.
# perl -I../../blib/lib -I../../blib/arch zoomtst1.pl <target> <query>
#
# See ../README for a description of this program.
# perl -I../../blib/lib -I../../blib/arch zoomtst1.pl <target> <query>
@@
-7,16
+7,23
@@
use strict;
use warnings;
use ZOOM;
use warnings;
use ZOOM;
-if (@ARGV != 2) {
- print STDERR "Usage: $0 target query\n";
+if (@ARGV < 2 || @ARGV %2 == 1) {
+ print STDERR "Usage: $0 target query [<option> <value> ...]\n";
print STDERR " eg. $0 z3950.indexdata.dk/gils computer\n";
exit 1;
}
print STDERR " eg. $0 z3950.indexdata.dk/gils computer\n";
exit 1;
}
-my($host, $query) = @ARGV;
+my $host = shift(@ARGV);
+my $query = shift(@ARGV);
eval {
my $conn = new ZOOM::Connection($host, 0);
$conn->option(preferredRecordSyntax => "usmarc");
eval {
my $conn = new ZOOM::Connection($host, 0);
$conn->option(preferredRecordSyntax => "usmarc");
+ while (@ARGV) {
+ my $key = shift(@ARGV);
+ my $value = shift(@ARGV);
+ $conn->option($key => $value);
+ }
+
my $rs = $conn->search_pqf($query);
my $n = $rs->size();
print "Query '$query' found $n records\n";
my $rs = $conn->search_pqf($query);
my $n = $rs->size();
print "Query '$query' found $n records\n";