1 # $Id: Connection.pm,v 1.4 2006-10-12 16:54:13 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_task", "set current task to $new");
87 my $old = $this->{next_task};
89 $this->{next_task} = $new;
90 $this->log("irspy_task", "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);
114 sub irspy_search_pqf {
116 my($query, $udata, %cb) = @_;
118 my $task = new ZOOM::IRSpy::Task::Search($query, $this, $udata, %cb);
119 $this->add_task($task);
127 my $tasks = $this->{tasks};
128 $tasks->[-1]->{next} = $task if @$tasks > 0;
130 $this->log("irspy_task", "added task $task");
140 Mike Taylor, E<lt>mike@indexdata.comE<gt>
142 =head1 COPYRIGHT AND LICENSE
144 Copyright (C) 2006 by Index Data ApS.
146 This library is free software; you can redistribute it and/or modify
147 it under the same terms as Perl itself, either Perl version 5.8.7 or,
148 at your option, any later version of Perl 5 you may have available.