perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Quatravaux <>
Subject Re: Am I running mod perl 2?
Date Mon, 01 Aug 2005 16:30:23 GMT
Hash: SHA1

Philip M. Gollucci wrote:

> Okay So I read this thread.


>> $ perl -Mmod_perl2 -e 'print $mod_perl2::VERSION' 2.000001
> Why is that not trustworth ?

Because we are obviously not *running* under mod_perl, but rather,
from a command-line Perl interpreter. The $mod_perl2::VERSION method
might be considered trustworthy enough for checking which version
(assuming singular!) of mod_perl is *installed*, but nobody cares
about that. One typically wants to know what version is *running* in
the current interpreter, in order to adjust behavior accordingly.

Case in point: when using Apache::DB from mod_perl 1.3 with mod_perl
2.0 also installed on the same system, the following code (actual
excerpt from Apache/ obviously goes SNAFU.

    use constant MP2 => eval { require mod_perl2; $mod_perl::VERSION >
1.99 };

Things get worse if I e.g. want to make some code interoperable
between standalone CGI and ModPerl::Registry (most likely the intent
of the original poster in the current thread). Then my admittedly
bizarre situation of having two mod_perls installed becomes irrelevant
to the issue at hand. Even with a single, up-to-date mod_perl 2
installed, any test based upon $mod_perl::VERSION would fail at
discriminating between /usr/bin/perl and
/usr/lib/apache2/modules/ And $ENV{MOD_PERL} does not cut
it either, for other reasons detailed in my previous post (wrong scoping).

> Are you saying you want a onliner function to return the version
> string absolutely regardless of which mod_perl or mod_perls are
> installed.

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 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.

- --
Dominique QUATRAVAUX                           Ingénieur senior
01 44 42 00 08                                 IDEALX

Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -


View raw message