You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jean-Michel Hiver <jh...@mkdoc.com> on 2003/03/24 13:28:13 UTC

SetEnv / PerlSetEnv issue

Hi List,

I am running Apache with some perl scripts and currently I am passing
configuration variables using SetEnv, for example:

  SetEnv FOO BAR

In the code:

my $foo_config = $ENV{FOO};

The problem is that I need to share these configuration variables with
mod_perl handlers. However in mod_perl handlers $ENV{FOO} is undef
despite the SetEnv directive.

So of course I tried PerlSetEnv so that I can use the dir_config()
method of the Apache object. But then $ENV{FOO} doesn't work in the CGI
script.

Everything works ok if I do:

  SetEnv     FOO BAR
  PerlSetEnv FOO BAR

But I would like to avoid duplicating config values for obvious
maintenability issues...

Can anyone think of a way to doing a "super SetEnv" directive that would
set FOO in both %ENV (for CGI scripts) and in $r->dir_config() ?

Thanks for your help,
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver@mkdoc.com  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/

Re: SetEnv / PerlSetEnv issue

Posted by Jean-Michel Hiver <jh...@mkdoc.com>.
> In which request phase you try to access envar ? If you using
> MP1 it "doesn't happen until the fixup phase" (from the guide).

Ok, this clears things up... I needed two config variables for my
PerlInitHandler. Well, it's only a couple of variables that aren't
likely to change once set, so I guess it's bareable to have them
duplicated :-/.

Thanks very much,
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver@mkdoc.com  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/