X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=793591df4d70d48917b84224ac7f2936db7cd401;hb=0f12bef2b5b4295e31f64ff48a84dc3a015fdcbf;hp=9190d9a12754addc9653087daa08a20553b21402;hpb=1235b30feac5935693ee46d698ac224cbc8f1387;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 9190d9a..793591d 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'; @@ -51,7 +53,7 @@ sub finalize_body { my $got; do { $got = read $body, my ($buffer), $CHUNKSIZE; - last unless $self->write( $c, $buffer ); + $got = 0 unless $self->write( $c, $buffer ); } while $got > 0; close $body; @@ -91,6 +93,11 @@ sub finalize_cookies { -httponly => $val->{httponly} || 0, ) ); + if (!defined $cookie) { + $c->log->warn("undef passed in '$name' cookie value - not setting cookie") + if $c->debug; + next; + } push @cookies, $cookie->as_string; } @@ -108,11 +115,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-