[Catalyst-commits] r6827 - in trunk/Catalyst-Action-RenderView: .
lib/Catalyst/Action
marcus at dev.catalyst.perl.org
marcus at dev.catalyst.perl.org
Sat Sep 1 10:46:37 GMT 2007
Author: marcus
Date: 2007-09-01 10:46:36 +0100 (Sat, 01 Sep 2007)
New Revision: 6827
Modified:
trunk/Catalyst-Action-RenderView/Changes
trunk/Catalyst-Action-RenderView/Makefile.PL
trunk/Catalyst-Action-RenderView/lib/Catalyst/Action/RenderView.pm
Log:
prepare to release new RenderView version
Modified: trunk/Catalyst-Action-RenderView/Changes
===================================================================
--- trunk/Catalyst-Action-RenderView/Changes 2007-08-31 14:17:47 UTC (rev 6826)
+++ trunk/Catalyst-Action-RenderView/Changes 2007-09-01 09:46:36 UTC (rev 6827)
@@ -1,4 +1,10 @@
-
+0.07 2007-09-01 11:03:00
+ - Add DateTime to default list of scrubbed objects
+ - Stringify rather than ref by default ,
+ more explicit message
+
+0.06 2007-08-29 16:35:00
+ - Add support for scrubbing stash objects.
- Remove undef warning
0.05 2007-04-26
Modified: trunk/Catalyst-Action-RenderView/Makefile.PL
===================================================================
--- trunk/Catalyst-Action-RenderView/Makefile.PL 2007-08-31 14:17:47 UTC (rev 6826)
+++ trunk/Catalyst-Action-RenderView/Makefile.PL 2007-09-01 09:46:36 UTC (rev 6827)
@@ -5,6 +5,7 @@
requires 'Catalyst::Runtime' => '5.70';
requires 'Test::More';
+requires 'Data::Visitor' => '0.08';
auto_install;
WriteAll;
Modified: trunk/Catalyst-Action-RenderView/lib/Catalyst/Action/RenderView.pm
===================================================================
--- trunk/Catalyst-Action-RenderView/lib/Catalyst/Action/RenderView.pm 2007-08-31 14:17:47 UTC (rev 6826)
+++ trunk/Catalyst-Action-RenderView/lib/Catalyst/Action/RenderView.pm 2007-09-01 09:46:36 UTC (rev 6827)
@@ -3,17 +3,45 @@
use strict;
use warnings;
-our $VERSION = '0.05';
+our $VERSION = '0.07';
use base 'Catalyst::Action';
+use Data::Visitor::Callback;
+use UNIVERSAL qw/can/;
+
+my %ignore_classes = ();
+
sub execute {
my $self = shift;
my ($controller, $c ) = @_;
$self->NEXT::execute( @_ );
+
+ $c->config->{debug}->{ignore_classes} = [ qw/
+ DBIx::Class::ResultSource::Table
+ DBIx::Class::ResultSourceHandle
+ DateTime
+ / ] unless exists $c->config->{debug}->{ignore_classes};
+
+ $c->config->{debug}->{scrubber_func} = sub { $_='[stringified to: ' . $_ . ']' }
+ unless exists $c->config->{debug}->{scrubber_func};
+
if ($c->debug && $c->req->params->{dump_info}) {
- die "forced debug"
+ unless ( keys %ignore_classes ) {
+ foreach my $class (@{$c->config->{debug}->{ignore_classes}}) {
+ $ignore_classes{$class} = $c->config->{debug}->{scrubber_func};
+ }
+ }
+ my $scrubber=Data::Visitor::Callback->new(
+ "ignore_return_values" => 1,
+ "object" => "visit_ref",
+ %ignore_classes,
+ );
+ $scrubber->visit( $c->stash );
+ $scrubber->visit( $c->config );
+ die('Forced debug - Scrubbed output');
}
+
if(! $c->response->content_type ) {
$c->response->content_type( 'text/html; charset=utf-8' );
}
@@ -62,6 +90,25 @@
See L<Catalyst::Action/METHODS/action>.
+=head1 SCRUBBING OUTPUT
+
+When you force debug with dump_info=1, RenderView is capable of removing
+classes from the objects in your stash. By default it will replace any
+DBIx::Class resultsource objects with the class name, which cleans up the
+debug output considerably, but you can change what gets scrubbed by
+setting a list of classes in $c->config->{debug}->{ignore_classes}.
+For instance:
+
+ $c->config->{debug}->{ignore_classes}=[];
+
+To disable the functionality. You can also set
+config->{debug}->{scrubber_func} to change what it does with the
+classes. For instance, this will undef it instead of putting in the
+class name:
+
+ $c->config->{debug}->{scrubber_func}=sub { undef $_ };
+
+
=head1 EXTENDING
To add something to an C<end> action that is called before rendering,
More information about the Catalyst-commits
mailing list