[Catalyst-commits] r12168 - in Catalyst-Runtime/5.80/trunk: . lib/Catalyst

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Thu Dec 3 17:15:17 GMT 2009


Author: t0m
Date: 2009-12-03 17:15:17 +0000 (Thu, 03 Dec 2009)
New Revision: 12168

Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm
Log:
I can't stand the over-long debug screens any more. Suggestions on how to do this in a less gross way?

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2009-12-03 17:15:12 UTC (rev 12167)
+++ Catalyst-Runtime/5.80/trunk/Changes	2009-12-03 17:15:17 UTC (rev 12168)
@@ -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)
 

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm	2009-12-03 17:15:12 UTC (rev 12167)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm	2009-12-03 17:15:17 UTC (rev 12168)
@@ -108,6 +108,24 @@
 
 =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;
+<h2><a href="#" onclick="toggleDump('dump_$i'); return false">%s</a></h2>
+<div id="dump_$i">
+    <pre wrap="">%s</pre>
+</div>
+EOF
+}
+
 sub finalize_error {
     my ( $self, $c ) = @_;
 
@@ -138,14 +156,7 @@
         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;
-<h2><a href="#" onclick="toggleDump('dump_$i'); return false">%s</a></h2>
-<div id="dump_$i">
-    <pre wrap="">%s</pre>
-</div>
-EOF
+            push @infos, $self->_dump_error_page_element($i, $dump);
             $i++;
         }
         $infos = join "\n", @infos;




More information about the Catalyst-commits mailing list