hotshot has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys !

When I clean my environment before executing a system command, using:
$ENV{PATH} = '/bin:/usr/bin'; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
Does It catches only for the followed system call?, or it catches for all system calls in the same scope as the cleaning above?

Thanks

Hotshot

Replies are listed 'Best First'.
Re: tainted invironment
by Juerd (Abbot) on Jan 23, 2002 at 15:51 UTC
    %ENV is global, so it depends on whether you have localized %ENV or not.

    $ENV{foo} = 'outside'; { local %ENV; $ENV{foo} = 'inside'; print `echo \$foo`; } print `echo \$foo`;

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$