Pass access-point as $udata into irspy_connect()
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Test / Search / Bib1.pm
1 # $Id: Bib1.pm,v 1.7 2006-10-12 14:40:24 mike Exp $
2
3 # See the "Main" test package for documentation
4
5 package ZOOM::IRSpy::Test::Search::Bib1;
6
7 use 5.008;
8 use strict;
9 use warnings;
10
11 use ZOOM::IRSpy::Test;
12 our @ISA = qw(ZOOM::IRSpy::Test);
13
14
15 sub start {
16     my $class = shift();
17     my($conn) = @_;
18
19     my @attrs = (1,             # personal name
20                  4,             # title
21                  52,            # subject
22                  1003,          # author
23                  1016,          # any
24                  );
25     foreach my $attr (@attrs) {
26         $conn->irspy_search_pqf("\@attr 1=$attr mineral", $attr,
27                                 ZOOM::Event::RECV_SEARCH, \&found,
28                                 exception => \&error);
29     }
30 }
31
32
33 sub found {
34     my($conn, $task, $attr, $event) = @_;
35
36     my $n = $task->{rs}->size();
37     $conn->log("irspy_test", "search on access-point $attr found $n record",
38                $n==1 ? "" : "s");
39     ### Need to get the BIB-1 attribute into this callback
40     $conn->record()->append_entry("irspy:status",
41                                   "<irspy:search_bib1 ap='$attr' ok='1'>" .
42                                   isodate(time()) .
43                                   "</irspy:search_bib1>");
44
45     return ZOOM::IRSpy::Status::TASK_DONE;
46 }
47
48
49 sub error {
50     my($conn, $task, $attr, $exception) = @_;
51
52     $conn->log("irspy_test", "search on access-point $attr had error: ",
53                $exception);
54     $conn->record()->append_entry("irspy:status",
55                                   "<irspy:search_bib1 ap='$attr' ok='0'>" .
56                                   isodate(time()) .
57                                   "</irspy:search_bib1>");
58     return ZOOM::IRSpy::Status::TASK_DONE;
59 }
60
61
62 1;