1 # $Id: Connection.pm,v 1.3 2006-10-12 14:35:43 mike Exp $
3 package ZOOM::IRSpy::Connection;
10 our @ISA = qw(ZOOM::Connection);
12 use ZOOM::IRSpy::Task::Connect;
13 use ZOOM::IRSpy::Task::Search;
18 ZOOM::IRSpy::Connection - ZOOM::Connection subclass with IRSpy functionality
22 This class provides some additional private data and methods that are
23 used by IRSpy but which would be useless in any other application.
24 Keeping the private data in these objects removes the need for ugly
25 mappings in the IRSpy object itself; adding the methods makes the
26 application code cleaner.
28 The constructor takes an additional first argument, a reference to the
29 IRSpy object that it is associated with.
37 my $this = $class->SUPER::create(@_);
38 $this->{irspy} = $irspy;
39 $this->{record} = undef;
48 return $this->{irspy};
56 my $old = $this->{record};
57 $this->{record} = $new if defined $new;
65 return $this->{tasks};
73 my $old = $this->{current_task};
75 $this->{current_task} = $new;
76 $this->log("irspy_debug", "set current task to $new");
87 my $old = $this->{next_task};
89 $this->{next_task} = $new;
90 $this->log("irspy_debug", "set next task to $new");
99 my($level, @msg) = @_;
101 $this->irspy()->log($level, $this->option("host"), " ", @msg);
107 my($udata, %cb) = @_;
109 my $task = new ZOOM::IRSpy::Task::Connect($this, $udata, %cb);
110 $this->add_task($task);
111 $this->log("irspy", "registered connect()");
115 sub irspy_search_pqf {
117 my($query, $udata, %cb) = @_;
119 my $task = new ZOOM::IRSpy::Task::Search($query, $this, $udata, %cb);
120 $this->add_task($task);
121 $this->log("irspy", "registered search_pqf($query)");
129 my $tasks = $this->{tasks};
130 $tasks->[-1]->{next} = $task if @$tasks > 0;
132 $this->log("irspy", "added task $task");
142 Mike Taylor, E<lt>mike@indexdata.comE<gt>
144 =head1 COPYRIGHT AND LICENSE
146 Copyright (C) 2006 by Index Data ApS.
148 This library is free software; you can redistribute it and/or modify
149 it under the same terms as Perl itself, either Perl version 5.8.7 or,
150 at your option, any later version of Perl 5 you may have available.