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