From 68be936d725114cdf77a71c6534ddd16aff94817 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 25 Oct 2006 10:52:53 +0000 Subject: [PATCH] Constructor now takes an options-hash argument. New method set_options() applies these to the connection. --- lib/ZOOM/IRSpy/Task.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/ZOOM/IRSpy/Task.pm b/lib/ZOOM/IRSpy/Task.pm index e39e184..7e4d3fb 100644 --- a/lib/ZOOM/IRSpy/Task.pm +++ b/lib/ZOOM/IRSpy/Task.pm @@ -1,4 +1,4 @@ -# $Id: Task.pm,v 1.2 2006-10-12 14:36:34 mike Exp $ +# $Id: Task.pm,v 1.3 2006-10-25 10:52:53 mike Exp $ package ZOOM::IRSpy::Task; @@ -32,13 +32,14 @@ pointer to the next task to be performed after this. sub new { my $class = shift(); - my($conn, $udata, %cb) = @_; + my($conn, $udata, $options, %cb) = @_; return bless { irspy => $conn->{irspy}, conn => $conn, - cb => \%cb, udata => $udata, + options => $options, + cb => \%cb, timeRegistered => time(), }, $class; } @@ -64,6 +65,17 @@ sub run { die "can't run base-class task $this"; } +sub set_options { + my $this = shift(); + + my %options = %{ $this->{options} }; + foreach my $key (sort keys %options) { + my $value = $options{$key}; + $this->conn()->log("irspy_debug", "$this setting option '$key' -> '$value'"); + $this->conn()->option($key, $value); + } +} + sub render { my $this = shift(); return "[base-class] " . ref($this); -- 1.7.10.4