You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Georg Grabler <gg...@gmail.com> on 2006/12/27 12:46:15 UTC
Problem with MODPERL_API_VERSION
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 {
does not work at all. If i print within the die message
$ENV{MOD_PERL_API_VERSION} nothing is displayed (undef? or '', i dont
know).
This is NOT my code, but the code failing at the moment. It's taken
out (once again) from the SOAP::Lite CPAN module.
Everywhere is documentated that this actually is the way to write
mod_perl modules for mod_perl 2.x. Why can this fail? How?
Any ideas? Did i miss to compile something, did i miss something in my
apache config for mod_perl to be loaded, so my environment is set
correclty?
Thank you,
Georg
Re: Problem with MODPERL_API_VERSION
Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Frank Wiles wrote:
> BEGIN {
> use constant MP2 => eval {
> exists $ENV{MOD_PERL_API_VERSION} and
> $ENV{MOD_PERL_API_VERSION} >= 2
> };
> }
In the future, >=2 might matter, but for now its either undef or exactly
== 2 which holds for 1.99023 and higher.
src/modules/perl/modperl_env.c
static modperl_env_ent_t MP_env_const_vars[] = {
MP_ENV_ENT("MOD_PERL", MP_VERSION_STRING),
MP_ENV_ENT("MOD_PERL_API_VERSION", MP_API_VERSION),
{ NULL }
};
from lib/ModPerl/Code.pm
my $api_v = $self->{build}->{API_VERSION};
print $h_fh qq(#define MP_API_VERSION "$api_v"\n);
from Makefile.PL:
$build->{API_VERSION} = $mod_perl2::API_VERSION;
from lib/mod_perl2.pm
# easy to parse request time API version - use
# $mod_perl2::VERSION for more granularity
our $API_VERSION = 2;
--
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/EC88A0BF 0DE5 C55C 6BF3 B235 2DAB B89E 1324 9B4F EC88 A0BF
Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.
Re: Problem with MODPERL_API_VERSION
Posted by Frank Wiles <fr...@wiles.org>.
On Wed, 27 Dec 2006 12:46:15 +0100
"Georg Grabler" <gg...@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 <fr...@wiles.org>
http://www.wiles.org
---------------------------------