1 # $Id: Connection.pm,v 1.1 2006-10-06 11:33:07 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::new(@_);
38 $this->{irspy} = $irspy;
39 $this->{record} = undef;
40 $this->{tasks} = undef;
48 return $this->{irspy};
56 my $old = $this->{record};
57 $this->{record} = $new if defined $new;
66 my $old = $this->{tasks};
67 $this->{tasks} = $new if defined $new;
76 my $old = $this->{current_task};
78 $this->{current_task} = $new;
79 $this->log("irspy_debug", "set current task to $new");
88 my($level, @msg) = @_;
90 $this->irspy()->log($level, $this->option("host"), " ", @msg);
98 $this->add_task(new ZOOM::IRSpy::Task::Connect($this, %cb));
99 $this->log("irspy", "registered connect()");
103 sub irspy_search_pqf {
105 my($query, %cb) = @_;
107 $this->add_task(new ZOOM::IRSpy::Task::Search($query, $this, %cb));
108 $this->log("irspy", "registered search_pqf($query)");
116 my $tasks = $this->tasks();
117 if (!defined $tasks) {
118 $this->tasks([ $task ]);
120 $tasks->[-1]->{next} = $task;
124 $this->log("irspy", "added task $task");
131 die "no task defined for " . $this->option("host")
134 $this->current_task($task);
145 Mike Taylor, E<lt>mike@indexdata.comE<gt>
147 =head1 COPYRIGHT AND LICENSE
149 Copyright (C) 2006 by Index Data ApS.
151 This library is free software; you can redistribute it and/or modify
152 it under the same terms as Perl itself, either Perl version 5.8.7 or,
153 at your option, any later version of Perl 5 you may have available.