1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

Use delete() to unset environment variables instead of assigning undef which

generates warning 'Use of uninitialized value in scalar assignment' with perl
versions older than 5.10
This commit is contained in:
Yang Tse 2010-01-20 20:08:50 +00:00
parent d2e1ec58f2
commit 471e8eefb6

View File

@ -295,17 +295,17 @@ my $protocol;
foreach $protocol (('ftp', 'http', 'ftps', 'https', 'no')) { foreach $protocol (('ftp', 'http', 'ftps', 'https', 'no')) {
my $proxy = "${protocol}_proxy"; my $proxy = "${protocol}_proxy";
# clear lowercase version # clear lowercase version
$ENV{$proxy} = undef if($ENV{$proxy}); delete $ENV{$proxy} if($ENV{$proxy});
# clear uppercase version # clear uppercase version
$ENV{uc($proxy)} = undef if($ENV{uc($proxy)}); delete $ENV{uc($proxy)} if($ENV{uc($proxy)});
} }
# make sure we don't get affected by other variables that control our # make sure we don't get affected by other variables that control our
# behaviour # behaviour
$ENV{'SSL_CERT_DIR'} = undef if($ENV{'SSL_CERT_DIR'}); delete $ENV{'SSL_CERT_DIR'} if($ENV{'SSL_CERT_DIR'});
$ENV{'SSL_CERT_PATH'} = undef if($ENV{'SSL_CERT_PATH'}); delete $ENV{'SSL_CERT_PATH'} if($ENV{'SSL_CERT_PATH'});
$ENV{'CURL_CA_BUNDLE'} = undef if($ENV{'CURL_CA_BUNDLE'}); delete $ENV{'CURL_CA_BUNDLE'} if($ENV{'CURL_CA_BUNDLE'});
####################################################################### #######################################################################
# Load serverpidfile hash with pidfile names for all possible servers. # Load serverpidfile hash with pidfile names for all possible servers.
@ -550,7 +550,7 @@ sub torture {
#logmsg "$_ Returned " . $ret >> 8 . "\n"; #logmsg "$_ Returned " . $ret >> 8 . "\n";
# Now clear the variable again # Now clear the variable again
$ENV{'CURL_MEMLIMIT'} = undef if($ENV{'CURL_MEMLIMIT'}); delete $ENV{'CURL_MEMLIMIT'} if($ENV{'CURL_MEMLIMIT'});
if(-r "core") { if(-r "core") {
# there's core file present now! # there's core file present now!
@ -2300,7 +2300,7 @@ sub singletest {
$oldenv{$var} = ($ENV{$var})?"$ENV{$var}":'notset'; $oldenv{$var} = ($ENV{$var})?"$ENV{$var}":'notset';
# set new value # set new value
if(!$content) { if(!$content) {
$ENV{$var} = undef if($ENV{$var}); delete $ENV{$var} if($ENV{$var});
} }
else { else {
$ENV{$var} = "$content"; $ENV{$var} = "$content";
@ -2621,7 +2621,7 @@ sub singletest {
if(%oldenv) { if(%oldenv) {
foreach my $var (keys %oldenv) { foreach my $var (keys %oldenv) {
if($oldenv{$var} eq 'notset') { if($oldenv{$var} eq 'notset') {
$ENV{$var} = undef if($ENV{$var}); delete $ENV{$var} if($ENV{$var});
} }
else { else {
$ENV{$var} = "$oldenv{$var}"; $ENV{$var} = "$oldenv{$var}";