environment inheritance..

K

ktom

when executing a 'system( some_other program );' from within a perl
script the environment it inherits, specifically the path, is unexpected.

i login to the work station and an environment is defined and used for
subsequent shells. and so it seems it is used for the 'system' command.

i would prefer that it use the environment of the shell from which the
perl script is called. as they are different and changing the other,
the login environment, requires that i log out and login once more.

is there a way to make the system call use the current environment..

thanks..

kevin
 
J

Joe Smith

ktom said:
when executing a 'system( some_other program );' from within a perl
script the environment it inherits, specifically the path, is unexpected.

Unless you've explicitly done something with %ENV, programs invoked
by system() have the same environment as when the perl script was
started from the command line.

If your perl script is being run some other way, such as by cron
or apache, it won't have the same environment as when run from the
command line. In such case, it is up to the author of the script to
make sure that $ENV{PATH} is correct.

Have you ever entered "perldoc -q environment" at the command line?
Any further questions should be posted to comp.lang.perl.misc
instead of here.
-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top