From: Mike Taylor Date: Wed, 25 Oct 2006 10:52:53 +0000 (+0000) Subject: Constructor now takes an options-hash argument. X-Git-Tag: CPAN-v1.02~54^2~867 X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=commitdiff_plain;h=512aa2caede0fcaa7f7700569a337bd65be48cb8 Constructor now takes an options-hash argument. New method set_options() applies these to the connection. --- 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);