X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=920fe0e6e84cde964671d08ad53b215ada9a8146;hb=684d10edf63074f94667d437db01d30b8d13cefc;hp=7b8fe9109b89948e2a118346fbca4b3a60cf208b;hpb=f4a57de40a851a87a5c9513fd8cb55dbd6cec12c;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 7b8fe91..920fe0e 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -45,14 +45,14 @@ Finalize body. Prints the response output. sub finalize_body { my ( $self, $c ) = @_; if ( ref $c->response->body && $c->response->body->can('read') ) { - my $buffer; while ( !$c->response->body->eof() ) { - $c->response->body->read( $buffer, $CHUNKSIZE ); - $self->write( $c, $buffer ); + $c->response->body->read( my $buffer, $CHUNKSIZE ); + last unless $self->write( $c, $buffer ); } + $c->response->body->close(); } else { - $self->write( $c, $c->response->output ); + $self->write( $c, $c->response->body ); } } @@ -90,7 +90,7 @@ sub finalize_cookies { sub finalize_error { my ( $self, $c ) = @_; - $c->res->headers->content_type('text/html'); + $c->res->content_type('text/html; charset=utf-8'); my $name = $c->config->{name} || 'Catalyst Application'; my ( $title, $error, $infos ); @@ -99,10 +99,11 @@ sub finalize_error { # For pretty dumps local $Data::Dumper::Terse = 1; $error = join '', - map { '' . encode_entities($_) . '' } + map { '

' . encode_entities($_) . '

' } @{ $c->error }; $error ||= 'No output'; $title = $name = "$name on Catalyst $Catalyst::VERSION"; + $name = "

$name

"; # Don't show context in the dump delete $c->req->{_context}; @@ -117,15 +118,21 @@ sub finalize_error { my $req = encode_entities Dumper $c->req; my $res = encode_entities Dumper $c->res; my $stash = encode_entities Dumper $c->stash; - $infos = <<""; -
-Request
-
$req
-Response
-
$res
-Stash
-
$stash
+ my @infos; + my $i = 0; + for my $dump ( $c->dump_these ) { + my $name = $dump->[0]; + my $value = encode_entities( Dumper $dump->[1] ); + push @infos, sprintf <<"EOF", $name, $value; +

%s

+
+
%s
+
+EOF + $i++; + } + $infos = join "\n", @infos; } else { $title = $name; @@ -145,9 +152,26 @@ sub finalize_error { $name = ''; } $c->res->body( <<"" ); - + + + + $title +