X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FTask.pm;h=1bdd8e43ca8cff14e007a5cc0ce7fb9ed116ea20;hp=04d5a3cb380ff6dee260218a9fc4f96352183e4e;hb=7ab42fd97d4e0726e483f3685e77ad5f6db9f743;hpb=a8be7db5305925fc720f3dac7e6afc8fba7b9e60 diff --git a/lib/ZOOM/IRSpy/Task.pm b/lib/ZOOM/IRSpy/Task.pm index 04d5a3c..1bdd8e4 100644 --- a/lib/ZOOM/IRSpy/Task.pm +++ b/lib/ZOOM/IRSpy/Task.pm @@ -1,4 +1,4 @@ -# $Id: Task.pm,v 1.1 2006-10-06 11:33:07 mike Exp $ +# $Id: Task.pm,v 1.4 2006-10-25 13:34:56 mike Exp $ package ZOOM::IRSpy::Task; @@ -32,11 +32,13 @@ pointer to the next task to be performed after this. sub new { my $class = shift(); - my($conn, %cb) = @_; + my($conn, $udata, $options, %cb) = @_; return bless { irspy => $conn->{irspy}, conn => $conn, + udata => $udata, + options => $options, cb => \%cb, timeRegistered => time(), }, $class; @@ -53,11 +55,29 @@ sub conn { return $this->{conn}; } +sub udata { + my $this = shift(); + return $this->{udata}; +} + sub run { my $this = shift(); die "can't run base-class task $this"; } +sub set_options { + my $this = shift(); + + foreach my $key (sort keys %{ $this->{options} }) { + my $value = $this->{options}->{$key}; + $value = "" if !defined $value; + $this->conn()->log("irspy_debug", "$this setting option '$key' -> ", + defined $value ? "'$value'" : "undefined"); + $this->{options}->{$key} = $this->conn()->option($key, $value); + #Net::Z3950::ZOOM::connection_option_set($this->conn()->_conn(), $key, $value); + } +} + sub render { my $this = shift(); return "[base-class] " . ref($this);