Hi all,
I'm using CGI.pm in Authentication phase (CGI 3.00/Apache 2.0.47/mod_perl 1.99_10). I've configured a location with lines like:
<Location /foo> SetHandler perl-script PerlResponseHandler Foo.pm PerlAuthenHandler AuthFoo.pm </Location>
From docs, it seems that it's necessary to set:
PerlOptions +GlobalRequest
only when using 'modperl' handler type because for 'perl-script' Location is enabled by default.
However I've "Global $r object is not available" in my error log.
It's necessary to set a +GlobalRequest option in order to use CGI.pm in phases other than Response? (adding PerlOptions +GlobalRequest all works fine).
It's tricky, because Apache doesn't tell mod_perl which handler it's running under till the response phase. 'SetHandler perl-script' is indeed setting the global request unless told not to, but only during the response phase. If you need a global request object to be available at the earlier or later phases you need to explicitly use 'PerlOptions +GlobalRequest' disregarding the setting of 'SetHandler'. I'll update the docs to be clear on that difference.
Besides starting from CGI.pm 2.93 you can pass $r to CGI's new object:
CGI->new($r);
in which case you don't need to set the global request object. So if your product can require CGI 2.93 or higher, it's the best to use the above technique.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html