perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John ORourke <john-modp...@o-rourke.org>
Subject Re: apache version check
Date Mon, 18 Jun 2007 21:05:58 GMT
_spitFIRE wrote:
> John ORourke wrote:
>   
>> use Apache2::ServerUtil;
>>     
> IMHO, doesn't this itself mean that you have Apache 2.x.x installed?
>   

Ah, you didn't say you were detecting v1 or v2 - I thought you just 
wanted to know the .x.x bit!

If you're just after a '1' or a '2' try:
    $version = ( $ENV{MOD_PERL_API_VERSION}==2 )?2:1;

Borrowing from the way CGI.pm does it you could do this:

my $version='none';
if($ENV{MOD_PERL_API_VERSION}==2){
    require Apache2::ServerUtil;
    $version=Apache2::ServerUtil::get_server_version();
}else{
    require Apache::Constants;
    $version=Apache::Constants::SERVER_VERSION;
}

(I haven't tested this by the way)

cheers
John


Mime
View raw message