in reply to Adding a directory to $ENV{PATH}
If you want to add to the and have that honored by system (or backticks or exec()), you'll need to reinvoke the script. In doing so, perl passes $ENV{PATH} to which ever flavor of exec(1) the runtime uses, where it will truly be part of the environment of the nested invocation of your script.
#!/usr/local/bin/perl5
if ( $ARGV[0] eq "child" ) {
print "child path: $ENV{PATH}\n";
exit(0);
}
$ENV{PATH} .= ":/dev/null";
print "parent path: $ENV{PATH}\n";
system("/usr/local/bin/perl5", $0, "child");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Adding a directory to $ENV{PATH}
by geektron (Curate) on Nov 03, 2000 at 05:02 UTC | |
by dws (Chancellor) on Nov 03, 2000 at 05:21 UTC | |
by geektron (Curate) on Nov 03, 2000 at 05:30 UTC |