Subject: | Fix for uninitialized value warning |
Hi Smylers,
When CGI::Lite is used to parse QUERY_STRING, with list context like this:
my %cgi = CGI::Lite->parse_form_data;
I get this warning when $ENV{QUERY_STRING} is empty:
Use of uninitialized value in hash dereference at /usr/share/perl5/CGI/Lite.pm line 671.
The attached patch fixes it, and will also avoid an unnecessary method call and string eval for this common case.
qef
diff -ur CGI-Lite-2.02.orig/Lite.pm CGI-Lite-2.02/Lite.pm
--- CGI-Lite-2.02.orig/Lite.pm 2003-08-19 19:53:08.000000000 +0100
+++ CGI-Lite-2.02/Lite.pm 2004-05-01 14:29:40.000000000 +0100
@@ -665,6 +665,7 @@
if ($request_method =~ /^(get|head)$/i) {
$query_string = $ENV{QUERY_STRING};
+ return unless $query_string;
$self->_decode_url_encoded_data (\$query_string, 'form');
return wantarray ?