Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 6006
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: ron [...] savage.net.au
rsav [...] deakin.edu.au
Cc:
AdminCc:

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



Subject: Non-existant CGI form fields vanish from sub parameter lists
Download (untitled) / with headers
text/plain 1.4k
CGI V 3.05. The rt.cpan.org menu only goes up to 3.04 :-(. This bug (as I believe it to be) has been around for years. I must apologize for not repoting it earlier. It only bites once every couple of years... In the sample code, sub one receives 1 parameter, although called with 2. CGI.pm is deleting the first parameter from the list because I deliberately refer to 'fake_name', a non-existant CGI form field, and CGI.pm does not in such a case return undef. In the sample output, note specifically the comma after '2nd param', coming from the join, indicating that '2nd param' has been passed in as the first parameter. Screen output: -----><8----- CGI.pm V 3.05 Old value: Param count: 1. Params: 2nd param, . New value: -----><8----- Program: -----><8----- #!/usr/bin/perl # # Name: # cgi-bug.cgi. # # Author: # Ron Savage <ron@savage.net.au> # http://savage.net.au/index.html. use strict; use warnings; use CGI; # ----------------- sub one { my($p1, $p2) = @_; 'Param count: ' . ($#_ + 1) . '. Params: '. join(', ', $p1, $p2) . '.'; } # End of one. # ----------------- my($q) = CGI -> new(); print $q -> header({type => 'text/html;charset=ISO-8859-1'}), $q -> start_html(), $q -> start_form({action => $q -> url(), name => 'cgi_bug'}), 'CGI.pm V ', $CGI::VERSION, $q -> br(), 'Old value: ' . one($q -> param('fake_name'), '2nd param'), $q -> br(), 'New value: ' . $q -> textfield({name => 'real_name', size => 20}), $q -> br(), $q -> submit(), $q -> end_form(), $q -> end_html(); -----><8-----
Date: Wed, 14 Apr 2004 14:42:10 -0400
From: Lincoln Stein <lstein [...] cshl.edu>
Subject: Re: [cpan #6006] Non-existant CGI form fields vanish from sub parameter lists
To: bug-CGI.pm [...] rt.cpan.org
RT-Send-Cc:
Download (untitled) / with headers
text/plain 2.1k
This is simply the behavior that you get when you call param() in a list context. It returns an empty list for a nonexistent variable rather than undef. This is well documented and is identical to the behavior of any perl function that returns a list. Lincoln On Tuesday 13 April 2004 10:04 pm, you wrote: Show quoted text
> This message about CGI.pm was sent to you by guest <> via > rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=6006 > > > CGI V 3.05. The rt.cpan.org menu only goes up to 3.04 :-(. > This bug (as I believe it to be) has been around for years. I must > apologize for not repoting it earlier. It only bites once every > couple of years... In the sample code, sub one receives 1 > parameter, although called with 2. CGI.pm is deleting the first > parameter from the list because I deliberately refer to > 'fake_name', a non-existant CGI form field, and CGI.pm does not in > such a case return undef. In the sample output, note specifically > the comma after '2nd param', coming from the join, indicating that > '2nd param' has been passed in as the first parameter. Screen > output: > -----><8----- > CGI.pm V 3.05 > Old value: Param count: 1. Params: 2nd param, . > New value: > -----><8----- > > Program: > -----><8----- > #!/usr/bin/perl > # > # Name: > # cgi-bug.cgi. > # > # Author: > # Ron Savage <ron@savage.net.au> > # http://savage.net.au/index.html. > > use strict; > use warnings; > > use CGI; > > # ----------------- > > sub one > { > my($p1, $p2) = @_; > > 'Param count: ' . ($#_ + 1) . '. Params: '. join(', ', $p1, $p2) . > '.'; > > } # End of one. > > # ----------------- > > my($q) = CGI -> new(); > > print $q -> header({type => 'text/html;charset=ISO-8859-1'}), > $q -> start_html(), > $q -> start_form({action => $q -> url(), name => 'cgi_bug'}), > 'CGI.pm V ', $CGI::VERSION, > $q -> br(), > 'Old value: ' . one($q -> param('fake_name'), '2nd param'), > $q -> br(), > 'New value: ' . $q -> textfield({name => 'real_name', size => > 20}), $q -> br(), > $q -> submit(), > $q -> end_form(), > $q -> end_html(); > -----><8-----
-- Lincoln D. Stein Cold Spring Harbor Laboratory 1 Bungtown Road Cold Spring Harbor, NY 11724
Download (untitled)
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Non-existant CGI form fields vanish from sub parameter lists (resolvable)
This report is ready to be marked as "resolved".


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.