Re: [WISH] A Perlish way to detect mod_perl major version (= not $ENV{MOD_PERL})

[prev] [thread] [next] [Date index for 2005/03/17]

From: John Siracusa
Subject: Re: [WISH] A Perlish way to detect mod_perl major version (= not $ENV{MOD_PERL})
Date: 20:06 on 17 Mar 2005
On Thu, 17 Mar 2005 14:57:24, Geoffrey Young <geoff@xxxxxxxxxxxxxxx.xxx>
wrote:
> just added to svn is $ENV{MOD_PERL_API_VERSION}, which is currently just "2".

Cool.

> what exactly is the issue you guys are trying to work around?

I'm writing code that's intended to work under both MP1 and MP2.  To split
off into the right module or section of code, I ask things like, "Am I
running in a mod_perl environment?" and "Am I in mod_perl 1 or 2?"

I'm not sure I understand the problems with using an environment variable
for this, but I'd be happy to see something better.  I'm basically just
looking for "officially blessed", "canonical" ways to ask those questions.

Looking at $ENV{'MOD_PERL'} is mostly fine with me, but it does bother me
that I have to strip out the version using a regex and then compare it to
1.99.  (What if the format of that string changes someday?)
$ENV{'MOD_PERL_API_VERSION'} will help there, I think.

-John


Re: [WISH] A Perlish way to detect mod_perl major version (= not $ENV{MOD_PERL})
John Siracusa 20:06 on 17 Mar 2005

Generated at 15:10 on 27 Mar 2005 by mariachi v0.52