Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl (http://www.velocityreviews.com/forums/f17-perl.html)
-   -   environment inheritance.. (http://www.velocityreviews.com/forums/t25502-environment-inheritance.html)

ktom 03-07-2005 09:16 PM

environment inheritance..
 
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

Joe Smith 03-08-2005 10:03 AM

Re: environment inheritance..
 
ktom wrote:
> 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


All times are GMT. The time now is 03:45 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.