environment inheritance..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ktom

    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

    #2
    Re: environment inheritance..

    ktom wrote:[color=blue]
    > when executing a 'system( some_other program );' from within a perl
    > script the environment it inherits, specifically the path, is unexpected.[/color]

    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

    Comment

    Working...