Skip to content

Commit

Permalink
Merge pull request #1149 from Grinnz/length_warning
Browse files Browse the repository at this point in the history
avoid uninitialized value in length warning on older perls
  • Loading branch information
bigpresh committed Feb 2, 2016
2 parents 12eff4a + 7d5080b commit bae8041
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Dancer/Request.pm
Expand Up @@ -171,7 +171,7 @@ sub new_for_request {
QUERY_STRING => $query_string || $ENV{QUERY_STRING} || '',
REQUEST_METHOD => $method
};
$env->{CONTENT_LENGTH} = length($body) if !exists $env->{CONTENT_LENGTH};
$env->{CONTENT_LENGTH} = defined($body) ? length($body) : 0 if !exists $env->{CONTENT_LENGTH};
my $req = $class->new(env => $env);
$req->{params} = {%{$req->{params}}, %{$params}};
$req->_build_params();
Expand Down

0 comments on commit bae8041

Please sign in to comment.