Subject: | CGI.pm feat. mod_perl 2.0.0-RC5 |
I found some problem in use CGI.pm (version 3.07) with mod_perl (version 2.0.0-RC5). Patch i provide is not compleetly tested but make able to start some application used CGI.pm under newest mod_perl.
--- CGI.pm.origin 2005-04-20 16:56:48.268120432 +0300
+++ CGI.pm 2005-04-20 18:49:19.889594233 +0300
@@ -183,9 +183,9 @@
if (defined $mod_perl::VERSION) {
if ($mod_perl::VERSION >= 1.99) {
$MOD_PERL = 2;
- require Apache::Response;
- require Apache::RequestRec;
- require Apache::RequestUtil;
+# require Apache::Response;
+# require Apache2::RequestRec;
+# require Apache::RequestUtil;
require APR::Pool;
} else {
$MOD_PERL = 1;
@@ -330,7 +330,7 @@
if (ref($initializer[0])
&& (UNIVERSAL::isa($initializer[0],'Apache')
||
- UNIVERSAL::isa($initializer[0],'Apache::RequestRec')
+ UNIVERSAL::isa($initializer[0],'Apache2::RequestRec')
)) {
$self->r(shift @initializer);
}
@@ -338,20 +338,20 @@
&& (UNIVERSAL::isa($initializer[0],'CODE'))) {
$self->upload_hook(shift @initializer, shift @initializer);
}
- if ($MOD_PERL) {
+ if ($MOD_PERL==1)
+ {
$self->r(Apache->request) unless $self->r;
my $r = $self->r;
- if ($MOD_PERL == 1) {
- $r->register_cleanup(\&CGI::_reset_globals);
- }
- else {
- # XXX: once we have the new API
- # will do a real PerlOptions -SetupEnv check
- $r->subprocess_env unless exists $ENV{REQUEST_METHOD};
- $r->pool->cleanup_register(\&CGI::_reset_globals);
- }
- undef $NPH;
+ $r->register_cleanup(\&CGI::_reset_globals);
+ }
+ elsif ($MOD_PERL == 2)
+ {
+ $self->r(Apache2::RequestUtil->request()) unless $self->r;
+ my $r = $self->r;
+ $r->subprocess_env unless exists $ENV{REQUEST_METHOD};
+ $r->pool->cleanup_register(\&CGI::_reset_globals);
}
+ undef $NPH if ($MOD_PERL);
$self->_reset_globals if $PERLEX;
$self->init(@initializer);
return $self;