Use safe new $conn->check() instead of old private _check().
[irspy-moved-to-github.git] / bin / find-different-access-point.pl
1 #!/usr/bin/perl -w
2
3 # $Id: find-different-access-point.pl,v 1.1 2006-10-17 15:25:51 mike Exp $
4 #
5 # Run like this:
6 #       find-different-access-point.pl fish bagel:210/gils bagel:210/marc
7 # This is not an IRSpy program: it's a ZOOM-Perl program, which is
8 # used to find a BIB-1 attribute that is supported differently by two
9 # or more targets.  Using the output of this, it's possible to create
10 # an IRSpy test plugin that passes one server and fails another.
11
12 use strict;
13 use warnings;
14 use ZOOM;
15
16 if (@ARGV < 3) {
17     print STDERR "Usage $0 <PQF> <target1> <target2> [<target3> ...]";
18     exit 1;
19 }
20
21 my $query = shift(@ARGV);
22 my @conns = map { new ZOOM::Connection($_) } @ARGV;
23
24 print "$query\n";
25 print "@ARGV\n";
26 for (my $i = 1; $i < 9999; $i++) {
27     print "$i";
28     my $different = 0;
29     my $sofar = undef;
30     foreach my $conn (@conns) {
31         my $rs;
32         eval { $rs = $conn->search_pqf("\@attr 1=$i $query") };
33         my $ok = !$@;
34         print "\t", $ok ? "ok(" . $rs->size(). ")" : "FAIL($@)";
35         if (!defined $sofar) {
36             $sofar = $ok;
37         } elsif ($ok != $sofar) {
38             $different = 1;
39         }
40     }
41     print "\n";
42     last if $different;
43 }