From: Mike Taylor Date: Wed, 25 Oct 2006 13:34:56 +0000 (+0000) Subject: set_options() now stores the old values in the stored options hash X-Git-Tag: CPAN-v1.02~917 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=f7f11e7931113a32e35189012a6a56ed5b0ca204;p=irspy-moved-to-github.git set_options() now stores the old values in the stored options hash that the new values were taken from, so that calling it for a second time restores the old values. (Well, nearly. Because there is no way to unset an option once it's been set, the best we can do is set such an option to the empty string. That seems to be good enough.) --- diff --git a/lib/ZOOM/IRSpy/Task.pm b/lib/ZOOM/IRSpy/Task.pm index 7e4d3fb..1bdd8e4 100644 --- a/lib/ZOOM/IRSpy/Task.pm +++ b/lib/ZOOM/IRSpy/Task.pm @@ -1,4 +1,4 @@ -# $Id: Task.pm,v 1.3 2006-10-25 10:52:53 mike Exp $ +# $Id: Task.pm,v 1.4 2006-10-25 13:34:56 mike Exp $ package ZOOM::IRSpy::Task; @@ -68,11 +68,13 @@ sub run { 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); + 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); } }