Hi there:
I'm using Apache2 and mod_perl 2.0.2 on a Debian Etch server, and just
ran into trouble when trying to run an unaltered CGI script using
ModPerl::PerlRun. The script I'm using is UseMod 0.92
(http://www.usemod.com/cgi-bin/wiki.pl?UseModWiki/OldVersions).
This particular script calls the CGI module's header() function, and
stores the return value in a variable. It then appends the HTML
contents of the page to this variable and prints it out. But it also
stores the contents of the variable in a file, which is used as a cache
so the page does not need to be regenerated the next time around.
This doesn't work any more with PerlRun. When using PerlRun, it seems
that header() directly alters the headers of the HTTP response, but
returns an empty string. Thus when a page is requested for the first
time, the headers get printed out, but they don't get stored in the
cache file. (It ends up storing only the HTML, not the HTTP headers.)
Then when the page is requested a second time, UseMod reads back the
file without headers and prints it out, resulting in "malformed header"
errors from Apache.
This problem would go away if header() returned the headers, rather than
an empty string. If this behaviour is not changed, it should at least
be documented to make it easier for people to figure out why a CGI
script doesn't run properly in PerlRun.
Just let me know if you need any more details about this problem. I'm
not subscribed to the mod_perl mailing list, so please write to me directly.
Regards,
Clayton
- [mp2] ModPerl::PerlRun changes behaviour of header(), brea... Clayton Smith
-