Subject: | PerlEx::DBI crashes CGI.pm |
Perl: ActivePerl 5.8.8 build 817
OS: Windows XP Pro SP2
test code:
#!/usr/bin/perl -w
BEGIN {
$ENV{'GATEWAY_INTERFACE'} = "CGI-PerlEx";
}
use strict;
use PerlEx::DBI;
use CGI;
my $cgi = CGI->new;
print $cgi->param ? 1 : 0;
__END__
output:
C:\Documents and Settings\burak\Desktop>perlex.pl
Can't locate Apache.pm in @INC (@INC contains: C:/Perl/lib
C:/Perl/site/lib .) at C:/Perl/lib/CGI.pm line 194.
Compilation failed in require at C:\Documents and
Settings\burak\Desktop\perlex.pl line 7.
BEGIN failed--compilation aborted at C:\Documents and
Settings\burak\Desktop\perlex.pl line 7.
PerlEx::DBI sets $ENV{MOD_PERL} to fool DBI, but this breaks CGI.pm.
To fix this problem, $PERLEX detection must be added before mod_perl,
and it must be used with mod_perl check:
C:\Perl\lib>diff CGI.pm CGI2.pm
180a181,183
Show quoted text
> # Turn on special checking for ActiveState's PerlEx
> $PERLEX++ if defined($ENV{'GATEWAY_INTERFACE'}) && $ENV
{'GATEWAY_INTERFACE'} =~ /^CGI-PerlEx/;
Show quoted text>
182c185
< if (exists $ENV{MOD_PERL}) {
---
Show quoted text> if (exists $ENV{MOD_PERL} && ! $PERLEX) {
198,200d200
< # Turn on special checking for ActiveState's PerlEx
< $PERLEX++ if defined($ENV{'GATEWAY_INTERFACE'}) && $ENV
{'GATEWAY_INTERFACE'} =~ /^CGI-PerlEx/;
<