Dominique Quatravaux <[EMAIL PROTECTED]> writes:

> I would like a robust way of checking the mod_perl version (or lack
> thereof) of the *currently running* Perl interpreter. I did kludge up
> one, but it is rear-end ugly (see code at the end of my post in the
> other thread).
>
> Support from mod_perl itself (e.g. in the form of a running_version()
> XS sub) would be helpful and robust. Causing mod_perl2.pm to fail
> initialization when not running under mod_perl (using an XS detection
> kludge like mine, *not* $ENV{MOD_PERL}) would be a second best.

I like the second-best option, actually: IMO "require mod_perl2"
should throw an exception unless we're actually running under the 
mod_perl.so interpreter.  People that only care about the installed
version would just need to

        eval {require mod_perl2};
        if ($@) {
           if ($@ =~ /^Can't locate mod_perl2/)
              $have_modperl2 = 0;
           elsif ($@ =~ /^Not running under mod_perl.so/)
              $have_modperl2 = 1;
        }
        else {
           # running under mod_perl.so
           $have_modperl2 = 1;
        }

-- 
Joe Schaefer

Reply via email to