develooper Front page | perl.perl5.porters | Postings from November 1999

Re: [ID 19991116.002] perl5.005_02: my_setenv() and Term::ReadLine::Gnu

From:
Rasmus Tamstorf
Date:
November 19, 1999 08:18
Subject:
Re: [ID 19991116.002] perl5.005_02: my_setenv() and Term::ReadLine::Gnu
Message ID:
Pine.SGI.4.10.9911190808080.28524-100000@toad.fas.fa.disney.com
On Fri, 19 Nov 1999, M.J.T. Guy wrote:

> Nick Ing-Simmons <nik@tiuk.ti.com> wrote
> > Thus as far as I can see unless we keep a hash of "things we malloc'ed"
> > and check for match we should not free() anything in environ.
> 
> Exactly.    And therefore, since we don't want memory leaks, we must
> keep a hash.

You just have to be careful about that when you're embedding perl in
another application that changes the environment. One problem is that
using perl malloc to create your hash will cause all sorts of bad things,
because the enviroment ends up being allocated by perl's malloc which
prevents the embedding application (which don't use perl malloc) to do any
further putenv's. 

Another problem (which is biting me :-( is that the practice of assigning
a new value to __environ (which is what you do when you create your hash)
seems to break on IRIX 6.2 using SGI's newest compiler (7.3) :-(

Rasmus

-----------------------------------------------------------------------------
Rasmus Tamstorf (tamstorf@fa.disney.com)  If you can dream it you can do it !
Walt Disney Feature Animation                                   - Walt Disney
-----------------------------------------------------------------------------





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About