environment inheritance..

Discussion in 'Perl' started by ktom, Mar 7, 2005.

  1. ktom

    ktom Guest

    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
     
    ktom, Mar 7, 2005
    #1
    1. Advertising

  2. ktom

    Joe Smith Guest

    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
     
    Joe Smith, Mar 8, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. maxw_cc
    Replies:
    1
    Views:
    3,145
    Martijn van Steenbergen
    Dec 21, 2003
  2. cppsks
    Replies:
    0
    Views:
    827
    cppsks
    Oct 27, 2004
  3. Replies:
    5
    Views:
    659
  4. karthikbalaguru
    Replies:
    9
    Views:
    1,041
  5. Daniel Pitts
    Replies:
    27
    Views:
    1,904
    Mike Schilling
    Feb 27, 2008
Loading...

Share This Page