Randy Kobes wrote:
> I'd be interested in any comments about these
> packages, including their names. CGI::Apache2::Ajax
> was tentatively chosen because, first of all, it only
> provides CGI.pm-compatible methods that the above two Ajax-related
> applications need, and also, CGI::Ajax
> expects the CGI object to satisfy
> ref($cgi) =~ /^CGI.*/
> Note though that, due to the nature of the APR::* modules
> used, CGI::Apache2::Ajax can also be used in a CGI
> environment. Thanks.
>
Maybe I'm missing something, but why not autodetect Apache2::Request +
mod_perl2 presence and fallback to CGI if it doesn't work?
Something like:
if (exists $ENV{MOD_PERL_API_VERSION} &&
$ENV{MOD_PERL_API_VERSION} >= 2 &&
eval {require Apache2::Request}) {
... mod_perl mode ...
} else {
... CGI mode ...
}
Issac