in reply to replicating the command 'unset LIBPATH' in perl
system('unset LIBPATH'); doesn't work since unset is a shell command, not a program.
system(q{sh -c 'unset LIBPATH'}); would run the shell command, but it would uselessly change the environment of a shell that exits immediately afterwards.
You want to change the current process's environment. delete $ENV{LIBPATH}; is the way to go. If it doesn't work, maybe because it's being done too late. Try putting it in a BEGIN {} block as near the top of your script as you can.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: replicating the command 'unset LIBPATH' in perl
by viffer (Beadle) on May 18, 2010 at 05:03 UTC | |
by ikegami (Patriarch) on May 18, 2010 at 05:57 UTC | |
by viffer (Beadle) on May 18, 2010 at 06:35 UTC | |
by Anonymous Monk on May 18, 2010 at 07:00 UTC | |
by JavaFan (Canon) on May 18, 2010 at 07:35 UTC | |
|