Skip Menu |
 

This queue is for tickets about the HTML-FillInForm CPAN distribution.

Report information
The Basics
Id: 22195
Status: resolved
Priority: 0/
Queue: HTML-FillInForm

People
Owner: Nobody in particular
Requestors: islue [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.06
Fixed in: (no value)



Subject: [PATCH]FillInForm doesn't work properly when handling value like [0]
If the $fdat is something like { foo => [0] } then it won't work as expected.
Subject: diff.txt
Download diff.txt
text/plain 721b
diff -r HTML-FillInForm-1.06.orig/lib/HTML/FillInForm.pm HTML-FillInForm-1.06/lib/HTML/FillInForm.pm 132c132 < $value = (shift @$value || '') if ref($value) eq 'ARRAY'; --- > $value = (defined $value->[0] ? $value->[0] : '') if ref($value) eq 'ARRAY'; 135c135 < $value = (shift @$value || '') if ref($value) eq 'ARRAY'; --- > $value = (defined $value->[0] ? $value->[0] : '') if ref($value) eq 'ARRAY'; 138c138 < $value = ($value->[0] || '') if ref($value) eq 'ARRAY'; --- > $value = (defined $value->[0] ? $value->[0] : '') if ref($value) eq 'ARRAY'; 214c214 < $value = (shift @$value || '') if ref($value) eq 'ARRAY'; --- > $value = (defined $value->[0] ? $value->[0] : '') if ref($value) eq 'ARRAY';
Subject: FillInForm doesn't work properly when handling value like [0]
From: Alexandr Ciornii <alexchorny [...] gmail.com>
Download (untitled) / with headers
text/plain 277b
On Oct 18 23:31:00 2006, ISLUE wrote: Show quoted text
> If the $fdat is something like > { foo => [0] } > then it won't work as expected.
Works in my case (HTML::FillInForm 1.06). Can you provide small example where it does not work as expected? ------- Alexandr Ciornii, http://chorny.net
Download (untitled) / with headers
text/plain 155b
The bug affects the elements below: input type text/hidden/password/radio textarea Here is an example of input type radio. -- http://islue.blogspot.com/
Download 22195.t
text/x-perl 548b
#!/usr/bin/perl use strict; use warnings; use HTML::FillInForm; my $fif = new HTML::FillInForm; local $/; my $html = <DATA>; my $fdat1 = { foo => 0 }; my $fdat2 = { foo => [0] }; my $output1 = $fif->fill( scalarref => \$html, fdat => $fdat1 ); my $output2 = $fif->fill( scalarref => \$html, fdat => $fdat2 ); print "$output1\n"; print "$output2\n"; __END__ <html> <body> <form> <input type="radio" name="foo" value="1"></input> <input type="radio" name="foo" value="0"></input> </form> </body> </html>
Ended up adapting slightly different patch from Paul Miller


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.