3 # $Id: test-pod.pl,v 1.5 2006-05-10 13:33:13 mike Exp $
6 # YAZ_LOG=pod perl -I lib test-pod.pl "bagel.indexdata.com/gils" "bagel.indexdata.com/marc"
13 my $pod = new ZOOM::Pod(@ARGV);
14 $pod->option(elementSetName => "b");
15 $pod->callback(ZOOM::Event::RECV_SEARCH, \&completed_search);
16 $pod->callback(ZOOM::Event::RECV_RECORD, \&got_record);
17 $pod->search_pqf("the");
18 my $err = $pod->wait();
19 die "$pod->wait() failed with error $err" if $err;
21 sub completed_search {
22 my($conn, $state, $rs, $event) = @_;
23 print $conn->option("host"), ": found ", $rs->size(), " records\n";
24 $state->{next_to_fetch} = 0;
25 $state->{next_to_show} = 0;
26 request_records($conn, $rs, $state, 2);
31 my($conn, $state, $rs, $event) = @_;
34 # Sanity-checking assertions. These should be impossible
35 my $ns = $state->{next_to_show};
36 my $nf = $state->{next_to_fetch};
38 die "next_to_show > next_to_fetch ($ns > $nf)";
39 } elsif ($ns == $nf) {
40 die "next_to_show == next_to_fetch ($ns)";
44 my $i = $state->{next_to_show}++;
45 my $rec = $rs->record($i);
46 print $conn->option("host"), ": record $i is ", render_record($rec), "\n";
47 request_records($conn, $rs, $state, 3)
48 if $i == $state->{next_to_fetch}-1;
54 my($conn, $rs, $state, $count) = @_;
56 my $i = $state->{next_to_fetch};
57 ZOOM::Log::log("appl", "requesting $count records from $i");
58 $rs->records($i, $count, 0);
59 $state->{next_to_fetch} += $count;
65 return "undefined" if !defined $rec;
66 return "'" . $rec->render() . "'";