X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FCGI.pm;h=e80c727a49a1a68acd556921d4b7541593e046a3;hb=3f822a28dfe633611ba16b252243b0e6d2c6abcd;hp=28e9ac027b50978b83cc3f954cb61c2bc9769ff7;hpb=08cf3dd6a376a350fe5bd244acc1bdfc1b7d6ba5;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/CGI.pm b/lib/Catalyst/Engine/CGI.pm index 28e9ac0..e80c727 100644 --- a/lib/Catalyst/Engine/CGI.pm +++ b/lib/Catalyst/Engine/CGI.pm @@ -57,6 +57,17 @@ This class overloads some methods from C. =over 4 +=item $c->finalize_body + +Prints the response output to STDOUT. + +=cut + +sub finalize_body { + my $c = shift; + print $c->response->output; +} + =item $c->finalize_headers =cut @@ -70,15 +81,18 @@ sub finalize_headers { print "\015\012"; } -=item $c->finalize_output - -Prints the response output to STDOUT. +=item $c->prepare_body =cut -sub finalize_output { +sub prepare_body { my $c = shift; - print $c->response->output; + + # XXX this is undocumented in CGI.pm. If Content-Type is not + # application/x-www-form-urlencoded or multipart/form-data + # CGI.pm will read STDIN into a param, POSTDATA. + + $c->request->body( $c->cgi->param('POSTDATA') ); } =item $c->prepare_connection @@ -170,8 +184,8 @@ sub prepare_path { =cut sub prepare_request { - my $c = shift; - $c->cgi( CGI->new ); + my ( $c, $cgi ) = @_; + $c->cgi( $cgi || CGI->new ); $c->cgi->_reset_globals; }