Skip Menu |

This queue is for tickets about the CGI-Lite CPAN distribution.

Report information
The Basics
Id: 6916
Status: rejected
Worked: 5 min
Priority: 0/
Queue: CGI-Lite

People
Owner: HOUSTON [...] cpan.org
Requestors: owl_40213 [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.02
Fixed in: (no value)



Subject: Multiple calls to parse_form_data multiply values
[I'm not sure if it's a bug, or projected behaviour] If I call parse_form_data function twice, I'm getting results as if I passed multiple values for the same variable: #!/usr/bin/perl -w use CGI::Lite; use Data::Dumper; $q=new CGI::Lite; $form=$q->parse_form_data; $form2=$q->parse_form_data; print "Content-type: text/html\n\n"; print "<pre>".Dumper($form2)."</pre>"; Testing with wget http://localhost/cgi-bin/test.cgi?foo=bar yields result: $VAR1 = { 'foo' => [ 'bar', 'bar' ] }; If you consider it a bug, then, I think, problem lies in Lite.pm:947 - push (@{ $self->{web_data}->{$key} }, $value); Or, rather in not clearing web_data var before parsing the form data. Thank you, Elena Khrissanova
Hello Elena, Thanks for reporting this. I'm inclined to think that it is not a bug, however. The clearing of the state is the only real difference between parse_form_data and parse_new_form_data. If you never want to add to reported values, but always replace them, then always using the latter method should give you the desired effect, I think. Would you agree? Note: I have only just taken over maintainership of this module (May 2014) and am working through the open bugs. Pete On Fri Jul 09 20:00:34 2004, guest wrote: Show quoted text
> [I'm not sure if it's a bug, or projected behaviour] > > If I call parse_form_data function twice, I'm getting results as if I > passed multiple values for the same variable: > > #!/usr/bin/perl -w > > use CGI::Lite; > use Data::Dumper; > > $q=new CGI::Lite; > $form=$q->parse_form_data; > $form2=$q->parse_form_data; > > print "Content-type: text/html\n\n"; > print "<pre>".Dumper($form2)."</pre>"; > > > Testing with > > wget http://localhost/cgi-bin/test.cgi?foo=bar > > yields result: > $VAR1 = { > 'foo' => [ > 'bar', > 'bar' > ] > }; > > If you consider it a bug, then, I think, problem lies in Lite.pm:947 - > > push (@{ $self->{web_data}->{$key} }, $value); > > Or, rather in not clearing web_data var before parsing the form data. > > Thank you, > Elena Khrissanova
No further response received from the original reporter. This does not appear to be a bug in the module as the suggested functionality is perfectly provided by another method in the same module.