Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am using mod_perl version 1.9. The exact version is 1.99921. I am running a script under PerlRun. This is what my conf file looks like:
<Location /perl> SetHandler perl-script PerlResponseHandler ModPerl::PerlRun PerlOptions +ParseHeaders Options +ExecCGI </Location>
So the script is running under /perl. The first time the script executes, everything is fine. But the next time, a header is not sent and there is an internal server error.

I am using the header function from CGI.pm. What I am doing is this in a base class:

use CGI qw(header); my $html = defined($ENV{'SERVER_SOFTWARE'}) ? header : ''; # More stuff gets added to $html before it prints to STDOUT
Why is the header sent the first time and not the next?

Thanks monks.

Replies are listed 'Best First'.
Re: mod_perl 1.9 header error
by blahblahblah (Priest) on Feb 21, 2006 at 05:42 UTC
    I remember there were some changes made to CGI.pm for mod_perl 2. I found this in the change log for CGI.pm:
    Version 3.08 1. update support for mod_perl 2.0. versions prior to mod_perl 1.999_22 (2.0.0-RC5) are no longer supported.
    So you may need either a newer mod_perl or an older CGI module?

    -Joe