Pass undefined $udata into irspy_connect()
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Test / Search / Title.pm
1 # $Id: Title.pm,v 1.6 2006-10-12 14:38:27 mike Exp $
2
3 # See the "Main" test package for documentation
4
5 package ZOOM::IRSpy::Test::Search::Title;
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     $conn->irspy_search_pqf('@attr 1=4 mineral', undef,
20                             ZOOM::Event::RECV_SEARCH, \&found,
21                             "exception", \&error);
22 }
23
24
25 sub found {
26     my($conn, $task, $__UNUSED_udata, $event) = @_;
27
28     my $n = $task->{rs}->size();
29     $conn->log("irspy_test",
30                "title search found $n record", $n==1 ? "" : "s");
31     my $rec = $conn->record();
32     $rec->append_entry("irspy:status", "<irspy:search_title ok='1'>" .
33                        isodate(time()) . "</irspy:search_title>");
34
35     return ZOOM::IRSpy::Status::TASK_DONE;
36 }
37
38
39 sub error {
40     my($conn, $task, $__UNUSED_udata, $exception) = @_;
41
42     $conn->log("irspy_test", "error: $exception");
43     my $rec = $conn->record();
44     $rec->append_entry("irspy:status", "<irspy:search_title ok='0'>" .
45                        isodate(time()) . "</irspy:search_title>");
46     return ZOOM::IRSpy::Status::TEST_BAD;
47 }
48
49
50 1;