From: Tomas Doran Date: Thu, 3 Dec 2009 17:15:17 +0000 (+0000) Subject: I can't stand the over-long debug screens any more. Suggestions on how to do this... X-Git-Tag: 5.80016~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=c96cdcef894409be1a70c0d0876c05d5d0687a22 I can't stand the over-long debug screens any more. Suggestions on how to do this in a less gross way? --- diff --git a/Changes b/Changes index 79f1df9..4fa4a01 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ # This file documents the revision history for Perl extension Catalyst. + New features: + - The __MOP__ hash element is suppressed from being dumped fully + (and instead stringified) when dumping the error screen to be + less packed with information of no use. + Documentation: - Fix Pod nits (RT#52370) diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 8936fab..b0a7014 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -108,6 +108,24 @@ 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 exists $val->{'__MOP__'}; + + my $text = encode_entities( dump( $val )); + sprintf <<"EOF", $name, $text; +

%s

+
+
%s
+
+EOF +} + sub finalize_error { my ( $self, $c ) = @_; @@ -138,14 +156,7 @@ sub finalize_error { my @infos; my $i = 0; for my $dump ( $c->dump_these ) { - my $name = $dump->[0]; - my $value = encode_entities( dump( $dump->[1] )); - push @infos, sprintf <<"EOF", $name, $value; -

%s

-
-
%s
-
-EOF + push @infos, $self->_dump_error_page_element($i, $dump); $i++; } $infos = join "\n", @infos;