X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=93565622b5f377e55b171c8c035c3f2609dfc2ec;hb=614f3ad66ca3dc9715fc2be41806428b1a44cde7;hp=22309080dd0066a22271ec02307a59dc491256a4;hpb=4d98d16dff4df87a96054967d73cf3c7a4801344;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 2230908..9356562 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -30,13 +30,11 @@ See L. =head1 METHODS -=over 4 - -=item $self->finalize_output +=head2 $self->finalize_output , see finalize_body -=item $self->finalize_body($c) +=head2 $self->finalize_body($c) Finalize body. Prints the response output. @@ -47,7 +45,7 @@ sub finalize_body { if ( ref $c->response->body && $c->response->body->can('read') ) { while ( !$c->response->body->eof() ) { $c->response->body->read( my $buffer, $CHUNKSIZE ); - $self->write( $c, $buffer ); + last unless $self->write( $c, $buffer ); } $c->response->body->close(); } @@ -56,7 +54,7 @@ sub finalize_body { } } -=item $self->finalize_cookies($c) +=head2 $self->finalize_cookies($c) =cut @@ -78,19 +76,19 @@ sub finalize_cookies { push @cookies, $cookie->as_string; } - if (@cookies) { - $c->res->headers->push_header( 'Set-Cookie' => join ',', @cookies ); + for my $cookie (@cookies) { + $c->res->headers->push_header( 'Set-Cookie' => $cookie ); } } -=item $self->finalize_error($c) +=head2 $self->finalize_error($c) =cut 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 ); @@ -98,11 +96,14 @@ sub finalize_error { # For pretty dumps local $Data::Dumper::Terse = 1; - $error = join '', - map { '' . encode_entities($_) . '' } - @{ $c->error }; + $error = join '', 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}; @@ -124,12 +125,7 @@ sub finalize_error { my $name = $dump->[0]; my $value = encode_entities( Dumper $dump->[1] ); push @infos, sprintf <<"EOF", $name, $value; -
- - %s - -
-
+

%s

%s
@@ -156,17 +152,22 @@ EOF $name = ''; } $c->res->body( <<"" ); - + + + + $title -