in reply to Problem running IPTraf from Perl
Some minor thought. %ENV is a global variable, thus everyone using it will be affected by changing it. Consider deciding whether you'd like to set the environment variable for the whole script, or just for your call to iptraf.
If it should be effective for your whole script set it at the beginning of the script, or some other well exposed place. If for the call to iptraf is sufficient consider localizing the change, like so:
{ local %ENV = %ENV; $ENV{TERM} = 'vt220'; # call iptraf, e.g. `/usr/sbin/iptraf -s eth0 -B -L some.log`; }
This will limit the changes to %ENV to the enclosing block, thus the environment will be restored once the block is left. See Temporary Values via local()
It might be worth remembering this for all global variables.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem running IPTraf from Perl
by RobPayne (Chaplain) on Jun 17, 2006 at 12:20 UTC | |
by rblasch (Monk) on Jun 17, 2006 at 12:55 UTC | |
|
Re^2: Problem running IPTraf from Perl
by Hue-Bond (Priest) on Jun 23, 2006 at 22:20 UTC |