X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=e770f325fb97fd8ade0cbe9ecd6dbd4ec8af6260;hb=fb495632d15d5aa112371bb5c3c39a6189ddb9a0;hp=4271aae2e4053c05ccc0a23ce7e20974b4afd47e;hpb=be1c95030e15ef9d081808462688ec09f7daed99;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 4271aae..e770f32 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -10,6 +10,8 @@ use HTML::Entities; use HTTP::Body; use HTTP::Headers; use URI::QueryParam; +use Encode (); +use utf8; use namespace::clean -except => 'meta'; @@ -50,8 +52,8 @@ sub finalize_body { if ( blessed($body) && $body->can('read') or ref($body) eq 'GLOB' ) { my $got; do { - read $body, my ($buffer), $CHUNKSIZE; - last unless $self->write( $c, $buffer ); + $got = read $body, my ($buffer), $CHUNKSIZE; + $got = 0 unless $self->write( $c, $buffer ); } while $got > 0; close $body; @@ -108,11 +110,37 @@ is in debug mode, or a `please come back later` message otherwise. =cut +sub _dump_error_page_element { + my ($self, $i, $element) = @_; + my ($name, $val) = @{ $element }; + + # This is fugly, but the metaclass is _HUGE_ and demands waaay too much + # scrolling. Suggestions for more pleasant ways to do this welcome. + local $val->{'__MOP__'} = "Stringified: " + . $val->{'__MOP__'} if ref $val eq 'HASH' && exists $val->{'__MOP__'}; + + my $text = encode_entities( dump( $val )); + sprintf <<"EOF", $name, $text; +
%s+
%s-