From b9208715f1af33e28a11156791c972d49a8363ec Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 30 May 2008 17:37:09 +0000 Subject: [PATCH] undefined warnings during Fields parsing Accessing undefined values pollutes error logs since d9f3acb221a71e094318c7b5d3809aa81dbb5bb3 (use warnings in all modules). --- lib/PLP/Fields.pm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/PLP/Fields.pm b/lib/PLP/Fields.pm index 212dec5..52040e3 100644 --- a/lib/PLP/Fields.pm +++ b/lib/PLP/Fields.pm @@ -12,7 +12,7 @@ sub doit { # %get my $get = \%PLP::Script::get; - if (length $ENV{QUERY_STRING}){ + if (defined $ENV{QUERY_STRING} and length $ENV{QUERY_STRING}){ for (split /[&;]/, $ENV{QUERY_STRING}) { my @keyval = split /=/, $_, 2; PLP::Functions::DecodeURI(@keyval); @@ -25,13 +25,10 @@ sub doit { tie %PLP::Script::post, 'PLP::Tie::Delay', 'PLP::Script::post', sub { my %post; - my $post; - - return \%post if $ENV{CONTENT_TYPE} !~ - m!^(?:application/x-www-form-urlencoded|$)!; - - $post = $PLP::read->($ENV{CONTENT_LENGTH}) if $ENV{CONTENT_LENGTH}; + return \%post unless $ENV{CONTENT_TYPE} and $ENV{CONTENT_LENGTH} and + $ENV{CONTENT_TYPE} =~ m!^(?:application/x-www-form-urlencoded|$)!; + my $post = $PLP::read->($ENV{CONTENT_LENGTH}); return \%post unless defined $post and length $post; for (split /&/, $post) { -- 2.30.0