-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Philip M. Gollucci wrote:
> Okay So I read this thread. Thanks! >> $ 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/DB.pm) 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/mod_perl.so. 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 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. - -- Dominique QUATRAVAUX Ingénieur senior 01 44 42 00 08 IDEALX -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFC7k4eMJAKAU3mjcsRAik+AKCBp5LeeZlW97NL/a1g2/y9jeK4VACgn97F /Om91wZ9u06SS2k/dk3M7DM= =a8FK -----END PGP SIGNATURE-----