updated log format
Marcus Ramberg [Fri, 19 May 2006 08:59:26 +0000 (08:59 +0000)]
updated debug dump.
more docs

Changes
Makefile.PL
lib/Catalyst.pm
lib/Catalyst/Engine.pm
lib/Catalyst/Log.pm
lib/Catalyst/Manual/Cookbook.pod
lib/Catalyst/Manual/Tutorial.pod

diff --git a/Changes b/Changes
index 0c6463c..b3d9216 100644 (file)
--- a/Changes
+++ b/Changes
@@ -9,6 +9,8 @@ This file documents the revision history for Perl extension Catalyst.
         - Fix pod to use DBIC::Schema instead of DBIC model
         - Fix ->config failing to copy _config for subclassing
         - ConfigLoader: Updated to version 0.07
+        - Updated log format
+        - Updated debug dump
 
 5.6902  2006-05-04 13:00:00
         - Remove tarballs and OSX metadata files.
index 5bbb8a9..739eb06 100644 (file)
@@ -10,8 +10,9 @@ requires 'UNIVERSAL::require' => "0.10";
 requires 'Carp';
 requires 'Class::Accessor::Fast';
 requires 'Class::Data::Inheritable';
-requires 'Class::Inspector';
+requires 'Class::Inspector' => '1.06';
 requires 'CGI::Cookie';
+requires 'Data::Dump';
 requires 'File::Modified';
 requires 'HTML::Entities';
 requires 'HTTP::Body'    => 0.5;
@@ -81,6 +82,10 @@ print <<"EOF";
     Install Task::Catalyst to get everything you need to start writing
     serious applications with Catalyst.
 
+    Note that Catalyst::Helper has been split into a separate distribution,
+    and is required for using catalyst.pl to make new distributions. It is
+    included with Task::Catalyst
+
         perl -MCPANPLUS -e 'install Task::Catalyst'
         perl -MCPAN -e 'install Task::Catalyst'
 
index 711fb16..c206761 100644 (file)
@@ -25,6 +25,8 @@ use attributes;
 use utf8;
 use Carp qw/croak/;
 
+BEGIN { require 5.008001; }
+
 __PACKAGE__->mk_accessors(
     qw/counter request response state action stack namespace stats/
 );
index 80ff49f..de506cb 100644 (file)
@@ -3,7 +3,7 @@ package Catalyst::Engine;
 use strict;
 use base 'Class::Accessor::Fast';
 use CGI::Cookie;
-use Data::Dumper;
+use Data::Dump qw/dump/;
 use HTML::Entities;
 use HTTP::Body;
 use HTTP::Headers;
@@ -99,7 +99,6 @@ sub finalize_error {
     if ( $c->debug ) {
 
         # For pretty dumps
-        local $Data::Dumper::Terse = 1;
         $error = join '', map {
                 '<p><code class="error">'
               . encode_entities($_)
@@ -120,15 +119,11 @@ sub finalize_error {
         # Don't show response header state in dump
         delete $c->res->{_finalized_headers};
 
-        my $req   = _fixup_debug_info($c->req);
-        my $res   = _fixup_debug_info($c->res);
-        my $stash = _fixup_debug_info($c->stash);
-
         my @infos;
         my $i = 0;
         for my $dump ( $c->dump_these ) {
             my $name  = $dump->[0];
-            my $value = encode_entities( Dumper $dump->[1] );
+            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">
@@ -576,12 +571,6 @@ sub write {
     print STDOUT $buffer;
 }
 
-sub _fixup_debug_info {
-    my $info   = encode_entities Dumper shift;
-     my @info = split "\n", $info; 
-     pop @info; shift @info;
-     return join "\n",@info;    
-}
 
 =head2 $self->finalize_output
 
index 24b7931..89f39e7 100644 (file)
@@ -2,7 +2,7 @@ package Catalyst::Log;
 
 use strict;
 use base 'Class::Accessor::Fast';
-use Data::Dumper;
+use Data::Dump;
 
 our %LEVELS = ();
 
@@ -62,8 +62,7 @@ sub disable {
 
 sub _dump {
     my $self = shift;
-    local $Data::Dumper::Terse = 1;
-    $self->info( Dumper(@_) );
+    $self->info( Data::Dump::dump(@_) );
 }
 
 sub _log {
index 4b370c8..db58529 100644 (file)
@@ -608,8 +608,8 @@ Cat app as C<MyApp::Model::DB>.
 By default, Catalyst will display its own error page whenever it
 encounters an error in your application. When running under C<-Debug>
 mode, the error page is a useful screen including the error message and
-a full Data::Dumper output of the C<$c> context object. When not in
-C<-Debug>, users see a simple "Please come back later" screen.
+L<Data::Dump> output of the relevant parts of the C<$c> context object. 
+When not in C<-Debug>, users see a simple "Please come back later" screen.
 
 To use a custom error page, use a special C<end> method to short-circuit
 the error processing. The following is an example; you might want to
index ef0db08..bb974f6 100644 (file)
@@ -177,8 +177,8 @@ the built-in mini-server as described in L<Getting started>.
 
 If you want to output any debugging information to the console, then
 call C<< $c->log->debug() >>, passing it a string to output. For data
-structures, C<use> L<Data::Dumper> and call C<<
-$c->log->debug(Dumper($structure)) >>
+structures, C<use> L<Data::Dump> qw/dump/; and call 
+C<< $c->log->debug(dump($structure)) >>
 
 =head2 Model/View/Controller