xyzzy has asked for the wisdom of the Perl Monks concerning the following question:
I have a script using CGI (standard mode) which is failing oddly. The script looks something like this:
if (defined param('fnord')) { # open log file and append some params... redirect(-uri => 'http://whoisxyzzy.com/fnord/', -status => '303') +; } else { # do some other stuff... }
The script originally just handled a query and generated a corresponding page. Then I decided to add another parameter, which if present would dump to a log and redirect. Everything works, but if 'fnord' is included in the query instead of getting redirected I get a 500. The log file is still updated, even when I (originally) had the redirect call before the logging, and when 'fnord' is undef it works as it did before I decided to be clever and add this lack of functionality.
UPDATE: I am an idiot. redirect() does not actually redirect, it only generates the header and requires a preceding print statement. XYZZY OUT!
$,=qq.\n.;print q.\/\/____\/.,q./\ \ / / \\.,q. /_/__.,q..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI redirect
by moritz (Cardinal) on Oct 29, 2009 at 18:30 UTC | |
by xyzzy (Pilgrim) on Oct 29, 2009 at 18:42 UTC | |
by moritz (Cardinal) on Oct 29, 2009 at 18:57 UTC | |
by Anonymous Monk on Oct 29, 2009 at 18:49 UTC |