From 8ffd16f0b1e14d9e81fadf0f624958b75da700fb Mon Sep 17 00:00:00 2001 From: "ian%hixie.ch" Date: Sun, 26 May 2002 15:02:33 +0000 Subject: [PATCH] Add some null checking -- if the string is undefined, then turn it into the empty string. This avoids many undefined value warnings when the data provided by the user is incomplete. --- webtools/PLIF/PLIF/Input/CGI.pm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/webtools/PLIF/PLIF/Input/CGI.pm b/webtools/PLIF/PLIF/Input/CGI.pm index 912a8569fe35..8cf90f515a92 100644 --- a/webtools/PLIF/PLIF/Input/CGI.pm +++ b/webtools/PLIF/PLIF/Input/CGI.pm @@ -73,13 +73,17 @@ sub splitArguments { my $value = $2; # decode the strings foreach my $string ($name, $value) { - $string =~ tr/+/ /; # convert + to spaces - $string =~ s/% # a percent symbol - ( # followed by - [0-9A-Fa-f]{2} # 2 hexidecimal characters - ) # which we shall put in $1 - /chr(hex($1)) # and convert back into a character - /egox; # (evaluate, globally, optimised, with comments) + if (defined($string)) { + $string =~ tr/+/ /; # convert + to spaces + $string =~ s/% # a percent symbol + ( # followed by + [0-9A-Fa-f]{2} # 2 hexidecimal characters + ) # which we shall put in $1 + /chr(hex($1)) # and convert back into a character + /egox; # (evaluate, globally, optimised, with comments) + } else { + $string = ''; + } } $self->addArgument($name, $value); } else {