Subject: | param interprets 0 and "" as missing value or name |
Date: | Mon, 21 Aug 2006 10:39:08 +0200 |
To: | Bugs in Workflow via RT <bug-Workflow [...] rt.cpan.org> |
From: | Michael Bell <mbell [...] informatik.hu-berlin.de> |
Hi,
Workflow 0.22
Perl 5.8.8
The module Workflow::Base implements the function param for all other
module. It includes two minor bugs.
1. param (0 => "FALSE VALUE")
This call results in the returning of all already stored parameters
because the first parameter will be evaluated as a false value in Perl
and the function only checks for a true value at the variable name.
2. param ("Test" => 0)
This call results in the returning of the value of the parameter Test
because 0 is a false value in Perl. The patch has still the problem that
undef as a value cannot be handled.
I will fix the erasing of parameters in another patch (some minutes
later ...). Actually it is not possible to erase a single context parameter.
Best regards
Michael
--
Show quoted text
_______________________________________________________________
Michael Bell Humboldt-Universitaet zu Berlin
Tel.: +49 (0)30-2093 2482 ZE Computer- und Medienservice
Fax: +49 (0)30-2093 2704 Unter den Linden 6
michael.bell@cms.hu-berlin.de D-10099 Berlin
_______________________________________________________________
--- Base.pm.org 2006-08-21 10:08:24.000000000 +0200
+++ Base.pm 2006-08-21 10:09:46.000000000 +0200
@@ -28,7 +28,7 @@
sub param {
my ( $self, $name, $value ) = @_;
- unless ( $name ) {
+ unless ( defined $name ) {
return { %{ $self->{PARAMS} } };
}
@@ -41,7 +41,7 @@
return { %{ $self->{PARAMS} } };
}
- unless ( $value ) {
+ unless ( defined $value ) {
if ( exists $self->{PARAMS}{ $name } ) {
return $self->{PARAMS}{ $name };
}