On Wed, 29 Jun 2005 16:36:46 +0200 Dominique Quatravaux <[EMAIL PROTECTED]> wrote:
> $mod_perl2::VERSION skips these drawbacks (it can only be altered from > Perl and is not inherited) but it is currently not trustworthy either: > > $ perl -Mmod_perl2 -e 'print $mod_perl2::VERSION' > 2.000001 Sorry for the late reply on this, managed to get way behind on E-mail over the last week. Why isn't that a reliable method? > BTW this problem triggers a bug in e.g. Apache::DB when several > installations of mod_perl (1.26 and 2.000001 in my case) cohabit on > the same system (I'm sending a separate bug report to Frank Wiles). > > The only reliable way of checking for mod_perl is by probing for an > "unusual" feature of the Perl runtime, say an XS sub that the core of > mod_perl provides directly. Here is the crock I'm currently using to > that effect: > > sub mod_perl_version { > my @discriminating_symbols = > (2 => "Apache2::XSLoader::BOOTSTRAP", > 1.99 => "Apache::XSLoader::BOOTSTRAP", > 1 => "Apache::exit"); > > use B; > while(my ($version, $discrimsymbol) = > splice(@discriminating_symbols, 0, 2)) { > no strict "refs"; > next if (! exists &{$discrimsymbol}); > my $bref = B::svref_2object(\&{$discrimsymbol}); > next if ( (! defined $bref) || (! $bref->XSUB()) ); > return $version; > } > return undef; > } Well I'm not entirely against doing this, but I wouldn't want to support older 1.99 releases of the code. This would just help encourage people to use old unsupported and/or non-standard MP2 APIs. --------------------------------- Frank Wiles <[EMAIL PROTECTED]> http://www.wiles.org ---------------------------------