On Sun, May 26, 2013 at 10:19 AM, James E Keenan via RT <perlbug-followup@perl.org> wrote: > On Fri Sep 24 12:21:12 2004, skartick@scitegic.com 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: http://perl5.git.perl.org/perl.git/blob/HEAD:/util.c#l1887 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: http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/todo.pod#l1022 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. Cheers, -JanThread Previous | Thread Next