perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Wiles <fr...@wiles.org>
Subject Re: Problem with MODPERL_API_VERSION
Date Wed, 27 Dec 2006 14:57:06 GMT
On Wed, 27 Dec 2006 12:46:15 +0100
"Georg Grabler" <ggrabler@gmail.com> wrote:

> Hello everybody around.
> 
> I've a strange problem occuring on my computer.
> 
> I've taken the script from the apache mod_perl documentation, pringing
> my environment variables (${ENV}).
> According to this, my MOD_PERL_API_VERSION is 2, what's fine so far.
> 
> Anyway, accessing them from ANY module, with the following code:
> MOD_PERL: {
>     ( (exists $ENV{MOD_PERL_API_VERSION}) &&
>       ($ENV{MOD_PERL_API_VERSION} == 2) ) and do {

   First I would double check that you're actually running under
   mod_perl by checking $ENV{MOD_PERL}. 

   As for detecting which version is in use at runtime, this code
   snippet is the "generally accepted way": 

   BEGIN { 
        use constant MP2 => eval { 
                            exists $ENV{MOD_PERL_API_VERSION} and
                            $ENV{MOD_PERL_API_VERSION} >= 2
        }; 
   }

   Then you can just do if tests on the MP2 constant. I think your
   problem may be the == 2 part, as you are very likely running 
   2.0.1, 2.0.2, 2.0.3, etc. 

   Hope this helps. 

 ---------------------------------
   Frank Wiles <frank@wiles.org>
   http://www.wiles.org
 ---------------------------------


Mime
View raw message