Subject: | Bug in Class::DBI::FromCGI |
Date: | Tue, 07 Nov 2006 13:46:07 +0200 |
To: | bug-Class-DBI-FromCGI [...] rt.cpan.org |
From: | Giannis Economou <gecon [...] di.uoa.gr> |
Hello...
I'm using Class::DBI::FromCGI and it really does the job I want. I've
just found something that must be a bug, and kind of important I guess...
Maybe I'm wrong somewhere? (I don't think so...)
Consider a form field named 'price' which is defined as 'required' and
untainted as_printable (in my example consider a form for a product
where the price field might have a value "call for info" or a numeric
price or the price 0).
If the form gets submitted with 'price' => '0', we are getting a "You
must supply 'price'" error.
Here is your code:
Show quoted text
> my $value = $h->extract("-as_$type" => $field);
> my $err = $h->error;
> if ($required{$field} and not $value) {
> $them->{_cgi_update_error}->{$field} = "You
> must supply '$field'";
the $value gets extracted correctly as 0, but the test:
if ($required{$field} and not $value)
get's to the error because $value = 0 and the field is required. Nothing
is wrong with a price=0, but FromCGI.pm gives an error.
This should not happen.
Regards,
Giannis Economou