projects
/
irspy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new() contructor removed, replaced by create()
[irspy-moved-to-github.git]
/
lib
/
ZOOM
/
IRSpy
/
Connection.pm
diff --git
a/lib/ZOOM/IRSpy/Connection.pm
b/lib/ZOOM/IRSpy/Connection.pm
index
74c24a8
..
7923893
100644
(file)
--- a/
lib/ZOOM/IRSpy/Connection.pm
+++ b/
lib/ZOOM/IRSpy/Connection.pm
@@
-1,4
+1,4
@@
-# $Id: Connection.pm,v 1.1 2006-10-06 11:33:07 mike Exp $
+# $Id: Connection.pm,v 1.2 2006-10-11 16:46:01 mike Exp $
package ZOOM::IRSpy::Connection;
package ZOOM::IRSpy::Connection;
@@
-30,14
+30,14
@@
IRSpy object that it is associated with.
=cut
=cut
-sub new {
+sub create {
my $class = shift();
my $irspy = shift();
my $class = shift();
my $irspy = shift();
- my $this = $class->SUPER::new(@_);
+ my $this = $class->SUPER::create(@_);
$this->{irspy} = $irspy;
$this->{record} = undef;
$this->{irspy} = $irspy;
$this->{record} = undef;
- $this->{tasks} = undef;
+ $this->{tasks} = [];
return $this;
}
return $this;
}
@@
-61,11
+61,8
@@
sub record {
sub tasks {
my $this = shift();
sub tasks {
my $this = shift();
- my($new) = @_;
- my $old = $this->{tasks};
- $this->{tasks} = $new if defined $new;
- return $old;
+ return $this->{tasks};
}
}
@@
-83,6
+80,20
@@
sub current_task {
}
}
+sub next_task {
+ my $this = shift();
+ my($new) = @_;
+
+ my $old = $this->{next_task};
+ if (defined $new) {
+ $this->{next_task} = $new;
+ $this->log("irspy_debug", "set next task to $new");
+ }
+
+ return $old;
+}
+
+
sub log {
my $this = shift();
my($level, @msg) = @_;
sub log {
my $this = shift();
my($level, @msg) = @_;
@@
-113,29
+124,13
@@
sub add_task {
my $this = shift();
my($task) = @_;
my $this = shift();
my($task) = @_;
- my $tasks = $this->tasks();
- if (!defined $tasks) {
- $this->tasks([ $task ]);
- } else {
- $tasks->[-1]->{next} = $task;
- push @$tasks, $task;
- }
-
+ my $tasks = $this->{tasks};
+ $tasks->[-1]->{next} = $task if @$tasks > 0;
+ push @$tasks, $task;
$this->log("irspy", "added task $task");
}
$this->log("irspy", "added task $task");
}
-sub start_task {
- my $this = shift();
- my($task) = @_;
- die "no task defined for " . $this->option("host")
- if !defined $task;
-
- $this->current_task($task);
- $task->run();
-}
-
-
=head1 SEE ALSO
ZOOM::IRSpy
=head1 SEE ALSO
ZOOM::IRSpy