[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: Problem with MODPERL_API_VERSION
From:       Frank Wiles <frank () wiles ! org>
Date:       2006-12-27 14:57:06
Message-ID: 20061227085706.da93fb5c.frank () wiles ! org
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic