Subject: | CGI::FormBuilder::Source::File Bug |
From: | DWUEPPEL [...] cpan.org |
I was using the CGI::FormBuilder::Source::File part to create my forms, however when I had a one value checkbox entry I was getting incorrect behavior. For example with this type of entry:
cb_input:
type: checkbox
name: Option
options: active=Have this item active
I would get two checkboxes instead of one. one called 'active' and the other 'Have this item active'. I tracked this down to what looks like
a problem with the C::F::S::File.pm file that splits the options apart. here is the patch that I did to solve the issue. Let me know if there is a better way to do this or if this patch is unnecessary.
--- File.pm 2010-01-05 09:55:40.000000000 -0500
+++ CGI/FormBuilder/Source/File.pm 2010-01-05 09:55:43.000000000 -0500
@@ -166,7 +166,7 @@
$ptr->{$term} = (ref $ptr->{$term})
? [ @{$ptr->{$term}}, @val ] :
@val > 1 ? \@val : $val[0];
} else {
- $ptr->{$term} = @val > 1 ? \@val : $val[0];
+ $ptr->{$term} = @val > 1 ? \@val : ref($val[0]) eq
'ARRAY' ? \@val : $val[0];
}
$inval = 1;
} else {