Front page | perl.perl5.porters |
Postings from May 2013
[perl #31711] embedded perl $ENV{PATH} cannot be changed in instance other than the first
Thread Next
From:
James E Keenan via RT
Date:
May 26, 2013 17:19
Subject:
[perl #31711] embedded perl $ENV{PATH} cannot be changed in instance other than the first
Message ID:
rt-3.6.HEAD-2650-1369588747-1026.31711-15-0@perl.org
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.
> I get "unable to start foo.sh: No such file or directory at -e line
> 2." It appears perl is not using the updated PATH.
>
> I am using perl 5.8.0, compile-time options: DEBUGGING MULTIPLICITY
> USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT on Red Hat
> Enterprise Linux WS release 3 (Taroon Update 1).
>
> The following is from the docs with modifications to show the problem:
>
> #include <EXTERN.h>
> #include <perl.h>
>
> #define SAY_HELLOA "-e", "print qq(Hi, A I'm $^X\n)"
> #define SAY_HELLOB "-e", "print qq(Hi, B I'm $^X\n); $ENV{PATH} .=
> \":/home/username/foo\"; open(FOO, \"foo.sh |\") or die \"unable to
> start foo.sh: $!\"; close FOO;"
> int main(int argc, char **argv, char **env)
> {
> PerlInterpreter
> *one_perl = perl_alloc(),
> *two_perl = perl_alloc();
> char *one_args[] = { "one_perl", SAY_HELLOA };
> char *two_args[] = { "two_perl", SAY_HELLOB};
> PERL_SET_CONTEXT(one_perl);
> perl_construct(one_perl);
> PERL_SET_CONTEXT(two_perl);
> perl_construct(two_perl);
> PERL_SET_CONTEXT(one_perl);
> perl_parse(one_perl, NULL, 3, one_args, (char **)NULL);
> PERL_SET_CONTEXT(two_perl);
> perl_parse(two_perl, NULL, 3, two_args, (char **)NULL);
> PERL_SET_CONTEXT(one_perl);
> perl_run(one_perl);
> PERL_SET_CONTEXT(two_perl);
> perl_run(two_perl);
> PERL_SET_CONTEXT(one_perl);
> perl_destruct(one_perl);
> PERL_SET_CONTEXT(two_perl);
> perl_destruct(two_perl);
> PERL_SET_CONTEXT(one_perl);
> perl_free(one_perl);
> PERL_SET_CONTEXT(two_perl);
> perl_free(two_perl);
> }
>
>
> This program will fail, and yes foo.sh exists and it is not in my
> initial
> path. However, if you run SAY_HELLOB in the the first interpreter
> everything will work!
>
> char *one_args[] = { "one_perl", SAY_HELLOB };
> char *two_args[] = { "two_perl", SAY_HELLOA};
>
> Any ideas, suggestions. I have tried this on win32 and it works fine.
>
>
> ---------------------------------------------------------------------
>
> [skartick@mocha bin]$ ./perl -V
> Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
> Platform:
> osname=linux, osvers=2.4.21-9.elsmp,
> archname=i686-linux-thread-multi
> uname='linux mocha.internal.scitegic.net 2.4.21-9.elsmp #1 smp thu
> jan 8 17:08:56 est 2004 i686 i686 i386 gnulinux '
> config_args=''
> hint=recommended, useposix=true, d_sigaction=define
> usethreads=define use5005threads=undef useithreads=define
> usemultiplicity=define
> useperlio=define d_sfio=undef uselargefiles=undef usesocks=undef
> use64bitint=undef use64bitall=undef uselongdouble=undef
> usemymalloc=n, bincompat5005=undef
> Compiler:
> cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
> -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm',
> optimize='-O2',
> cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
> -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
> ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-24)',
> gccosandvers=''
> intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
> d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
> ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
> lseeksize=4
> alignbytes=4, prototype=define
> Linker and Libraries:
> ld='cc', ldflags =' -L/usr/local/lib'
> libpth=/usr/local/lib /lib /usr/lib
> libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
> perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
> libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so
> gnulibc_version='2.3.2'
> Dynamic Linking:
> dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
> -Wl,-rpath,/home/skartick/pp/scitegic_root/packages_linux32/perl/perl-5.
> 8.4/lib/5.8.4/i686-linux-thread-multi/CORE'
> cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
>
> Characteristics of this binary (from libperl):
> Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT
> Built under linux
> Compiled at Jun 2 2004 17:25:54
> %ENV:
> PERL5LIB=":../lib/5.8.4:../lib/site_perl"
> @INC:
> ../lib/5.8.4/i686-linux-thread-multi
> ../lib/5.8.4
> ../lib/site_perl/5.8.4/i686-linux-thread-multi
> ../lib/site_perl/5.8.4
> ../lib/site_perl
> /home/skartick/perlbuild/perl/lib/5.8.4/i686-linux-thread-multi
> /home/skartick/perlbuild/perl/lib/5.8.4
>
> /home/skartick/perlbuild/perl/lib/site_perl/5.8.4/i686-linux-thread-mult
> i
> /home/skartick/perlbuild/perl/lib/site_perl/5.8.4
> /home/skartick/perlbuild/perl/lib/site_perl
> .
>
>
> ------------------------------------------------------------------------
> ---------------------------------
>
>
> thanks ... sherwin
>
> ---
> R. Sherwin Kartick
Is there anyone familiar with embedded Perl who could evaluate the
problem described in this older ticket?
Thank you very much.
Jim Keenan
---
via perlbug: queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=31711
Thread Next
-
[perl #31711] embedded perl $ENV{PATH} cannot be changed in instance other than the first
by James E Keenan via RT