Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: simon-cpan [...] unitycode.org
Cc:
AdminCc:

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



Subject: hash is not reset before each() is called
Download (untitled) / with headers
text/plain 863b
Very subtle bug / best practice issue that can cause FillInForm to fill in nothing. If you call $fif->fill( fdata=>\%some_hash ) and you have previously done an each(%some_hash) or called Dumper(\%some_hash), FillInForm will not fill in any of your fields as the pointer that each() uses will already be at the end of %some_hash -- resulting in nothing being copied into %copy The solution is to call keys() on %$fdat before the while loop: --- HTML/FillInForm.pm 2007-02-15 15:35:49.000000000 -0500 +++ HTML/FillInForm.pm 2007-02-15 15:38:07.000000000 -0500 @@ -41,6 +41,7 @@ if (my $fdat = $option{fdat}){ # Copy the structure to prevent side-effects. my %copy; + keys %$fdat; while(my($key, $val) = each %$fdat) { next if exists $ignore_fields{$key}; $copy{ $key } = ref $val eq 'ARRAY' ? [ @$val ] : $val; Cheers, spd


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.