set_options() now stores the old values in the stored options hash
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Task.pm
index e39e184..1bdd8e4 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Task.pm,v 1.2 2006-10-12 14:36:34 mike Exp $
+# $Id: Task.pm,v 1.4 2006-10-25 13:34:56 mike Exp $
 
 package ZOOM::IRSpy::Task;
 
 
 package ZOOM::IRSpy::Task;
 
@@ -32,13 +32,14 @@ pointer to the next task to be performed after this.
 
 sub new {
     my $class = shift();
 
 sub new {
     my $class = shift();
-    my($conn, $udata, %cb) = @_;
+    my($conn, $udata, $options, %cb) = @_;
 
     return bless {
        irspy => $conn->{irspy},
        conn => $conn,
 
     return bless {
        irspy => $conn->{irspy},
        conn => $conn,
-       cb => \%cb,
        udata => $udata,
        udata => $udata,
+       options => $options,
+       cb => \%cb,
        timeRegistered => time(),
     }, $class;
 }
        timeRegistered => time(),
     }, $class;
 }
@@ -64,6 +65,19 @@ sub run {
     die "can't run base-class task $this";
 }
 
     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);
 sub render {
     my $this = shift();
     return "[base-class] " . ref($this);