develooper Front page | perl.perl5.porters | Postings from May 2013

Re: [perl #31711] embedded perl $ENV{PATH} cannot be changed ininstance other than the first

Thread Previous | Thread Next
Jan Dubois
May 27, 2013 18:22
Re: [perl #31711] embedded perl $ENV{PATH} cannot be changed ininstance other than the first
Message ID:
On Sun, May 26, 2013 at 10:19 AM, James E Keenan via RT
<> wrote:
> On Fri Sep 24 12:21:12 2004, wrote:
>> I have embedded perl in my c program, however I have encountered a
>> problem where the $ENV{PATH} can only be updated in the first
>> PerlInterpreter instance.


>> Any ideas, suggestions.  I have tried this on win32 and it works fine.
> Is there anyone familiar with embedded Perl who could evaluate the
> problem described in this older ticket?

This behavior is by design: the POSIX environment is shared by all
threads in a process, so Perl limits access to the OS level
environment to the first Perl interpreter instantiated in a process.
This was done with ithreads in mind, but applies equally to multiple
embedded interpreters if Perl was compiled with USE_ITHREADS:

On Windows Perl uses a virtualized environment (PerlHost), which does
keep per-interpreter copies of things like the environment and the
cwd, and uses these for spawning subprocesses.

Implementation of a similar hosting layer for Unix is still a wishlist item:

A workaround for embedding might be to compile Perl without
USE_ITHREADS. I haven't thought through the potential implications
this might have for running multiple interpreters concurrently in
different threads in this configuration.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About