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: 24684
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: callumgibson [...] optusnet.com.au
Cc:
AdminCc:

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



Subject: uninitialized value with startform with non-apache webserver
Date: 31 Jan 2007 15:20:16 +1100
Date: Wed, 31 Jan 2007 15:20:16 +1100
To: bug-CGI.pm [...] rt.cpan.org
From: Callum Gibson <callumgibson [...] optusnet.com.au>
startform calls request_uri() which returns $ENV{REQUEST_URI} which is an Apache-specific environment variable. This has been a recurring issue since it was introduced and all code now seems to check if request_uri is defined upon use, but calling $self->request_uri causes an "uninitialized value" warning if you run your CGI under perl -w using a non-Apache webserver. Since undefined values of request_uri appear to be already handled, modifying the subroutine request_uri to the following would seem to be sufficient: sub request_uri { return $ENV{'REQUEST_URI'} if defined($ENV{REQUEST_URI}); return undef; } -- Callum Gibson @ home http://members.optusnet.com.au/callumgibson/
On Tue Jan 30 23:20:34 2007, callumgibson@optusnet.com.au wrote: Show quoted text
> startform calls request_uri() which returns $ENV{REQUEST_URI} which is > an Apache-specific environment variable. This has been a recurring issue > since it was introduced and all code now seems to check if request_uri > is defined upon use, but calling $self->request_uri causes an > "uninitialized value" warning if you run your CGI under perl -w using > a non-Apache webserver. > > Since undefined values of request_uri appear to be already handled, > modifying the subroutine request_uri to the following would seem to > be sufficient: > > sub request_uri { > return $ENV{'REQUEST_URI'} if defined($ENV{REQUEST_URI}); > return undef; > }
Thanks for the report. I agree a change like this should be made, although I might express it a bit differently: return (defined $ENV{REQUEST_URI}) ? $ENV{REQUEST_URI} : undef; It seems some related routines like path_translated and content_type might as well get the same treatment. Mark
Thanks, this patch is now in our new git repo. Stalling till launch.
Subject: released, thanks.
I believe this change was released today as part of CGI.pm 3.45. Thanks for the contribution.