You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by martin langhoff <ma...@scim.net> on 2000/07/28 22:24:59 UTC

manipulating %ENV

hi,

	how safe is to manipulate %ENV in the context of an Embperl page under
modperl? Does it get cleaned up or does it stay around?

	The qquestion is: is %ENV localized or do I face risks when altering
its values?




martin

RE: manipulating %ENV

Posted by Dirk Lutzebaeck <lu...@aeccom.com>.
Gerald Richter writes:
 > > <Location "/mydir/">
 > > 	PerlSetEnv	ORACLE_HOME /oracle/home/
 > > </Location>
 > > 
 > 
 > Use 
 > 
 > PassEnv ORACLE_HOME

or make it a closure and export it in a module:

use Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(&env);

{
  my %_env = %ENV;
  sub env { $_env{$_[0]} }
}

... and later ...

$oracle_home = env('ORACLE_HOME');

Dirk


RE: manipulating %ENV

Posted by Gerald Richter <ri...@ecos.de>.
> <Location "/mydir/">
> 	PerlSetEnv	ORACLE_HOME /oracle/home/
> </Location>
> 

Use 

PassEnv ORACLE_HOME

see Apache docs for more information

Gerald


RE: manipulating %ENV

Posted by Jack Cushman <jc...@davanita.com>.
It's funny you should ask that. I am actually dealing with issues around
that same problem right now. (I must admit I am running a fairly archaic
version of mod_perl -- 1.21 -- so I'd love to hear it if someone else has
newer information).

What I have discovered is that the %ENV variables are in no way permanent,
to avoid the problem you mention. In fact, they are removed at some point
after the server starts (perhaps after one execution on each thread?).
Therefore I run into the reverse problem -- %ENV entries are arbitrarily
empty when I need their values. My solution has been something like:

<Location "/mydir/">
	PerlSetEnv	ORACLE_HOME /oracle/home/
</Location>

which gets re-executed whenever any of those pages are hit.

This seems like a pretty inefficient solution to me -- better would be if
mod_perl simply gave each script a local copy of %ENV. Does anyone know a
better way to do it?

> -----Original Message-----
> From: martin langhoff [mailto:martin@scim.net]
> Sent: Friday, July 28, 2000 4:25 PM
> To: embperl@perl.apache.org
> Subject: manipulating %ENV
>
>
> hi,
>
> 	how safe is to manipulate %ENV in the context of an Embperl
> page under
> modperl? Does it get cleaned up or does it stay around?
>
> 	The qquestion is: is %ENV localized or do I face risks when altering
> its values?
>
>
>
>
> martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org


RE: manipulating %ENV

Posted by Gerald Richter <ri...@ecos.de>.
hi,
> 
> 	how safe is to manipulate %ENV in the context of an Embperl 
> page under
> modperl? Does it get cleaned up or does it stay around?
> 
> 	The qquestion is: is %ENV localized or do I face risks when altering
> its values?
> 

Yes, %ENV is localized

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------