[Catalyst-commits] r9056 - in trunk/Catalyst-Action-RenderView: . lib/Catalyst/Action

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Sun Jan 11 23:34:12 GMT 2009


Author: t0m
Date: 2009-01-11 23:34:12 +0000 (Sun, 11 Jan 2009)
New Revision: 9056

Modified:
   trunk/Catalyst-Action-RenderView/Changes
   trunk/Catalyst-Action-RenderView/lib/Catalyst/Action/RenderView.pm
Log:
Change configuration from ->config->{debug} to ->config->{Action::RenderView}, with back-compat for the old namespace

Modified: trunk/Catalyst-Action-RenderView/Changes
===================================================================
--- trunk/Catalyst-Action-RenderView/Changes	2009-01-10 16:44:03 UTC (rev 9055)
+++ trunk/Catalyst-Action-RenderView/Changes	2009-01-11 23:34:12 UTC (rev 9056)
@@ -1,3 +1,9 @@
+0.08
+    - Store config in $c->config->{'Action::RenderView'}
+      instead of $c->config->{debug}.
+      Config from $c->config->{debug} is deprecated, but
+      still supported.
+
 0.08 2008-05-02 19:40:00
     - Add AsCGI to list of test requirements.
     - Check for defined()ness of $c->res->body so "0" is valid. (RT #30564)

Modified: trunk/Catalyst-Action-RenderView/lib/Catalyst/Action/RenderView.pm
===================================================================
--- trunk/Catalyst-Action-RenderView/lib/Catalyst/Action/RenderView.pm	2009-01-10 16:44:03 UTC (rev 9055)
+++ trunk/Catalyst-Action-RenderView/lib/Catalyst/Action/RenderView.pm	2009-01-11 23:34:12 UTC (rev 9056)
@@ -17,19 +17,23 @@
     my ($controller, $c ) = @_;
     $self->NEXT::execute( @_ );
     
-    $c->config->{debug}->{ignore_classes} = [ qw/
+    $c->config->{'Action::RenderView'}->{ignore_classes} = 
+        ( ref($c->config->{'debug'}) eq 'HASH' ? $c->config->{'debug'}->{ignore_classes} : undef )
+        || [ qw/
         DBIx::Class::ResultSource::Table 
         DBIx::Class::ResultSourceHandle
         DateTime
-        / ] unless exists $c->config->{debug}->{ignore_classes};
+        / ] unless exists $c->config->{'Action::RenderView'}->{ignore_classes};
 
-    $c->config->{debug}->{scrubber_func} = sub { $_='[stringified to: ' .  $_ . ']' }
-        unless exists $c->config->{debug}->{scrubber_func};
+    $c->config->{'Action::RenderView'}->{scrubber_func} = 
+        ( ref($c->config->{'debug'}) eq 'HASH' ? $c->config->{'debug'}->{scrubber_func} : undef )
+        || sub { $_='[stringified to: ' .  $_ . ']' }
+        unless exists $c->config->{'Action::RenderView'}->{scrubber_func};
     
     if ($c->debug && $c->req->params->{dump_info}) {
         unless ( keys %ignore_classes ) {
-            foreach my $class (@{$c->config->{debug}->{ignore_classes}}) {
-                $ignore_classes{$class} = $c->config->{debug}->{scrubber_func};
+            foreach my $class (@{$c->config->{'Action::RenderView'}->{ignore_classes}}) {
+                $ignore_classes{$class} = $c->config->{'Action::RenderView'}->{scrubber_func};
             }
         } 
         my $scrubber=Data::Visitor::Callback->new(
@@ -96,19 +100,26 @@
 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}.
+setting a list of classes in 
+$c->config->{'Action::RenderView'}->{ignore_classes}.
 For instance:
 
-    $c->config->{debug}->{ignore_classes}=[]; 
+    $c->config->{'Action::RenderView'}->{ignore_classes}=[]; 
     
 To disable the functionality. You can also set 
-config->{debug}->{scrubber_func} to change what it does with the 
+config->{'Action::RenderView'}->{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 $_ }; 
+    $c->config->{'Action::RenderView'}->{scrubber_func}=sub { undef $_ }; 
 
+=head2 Deprecation notice
 
+This plugin used to be configured by setting C<< $c->config->{debug} >>.
+That configuration key is still supported in this release, but is 
+deprecated, please use the C< 'Action::RenderView' > namespace as shown 
+above for configuration in new code.
+
 =head1 EXTENDING
 
 To add something to an C<end> action that is called before rendering,




More information about the Catalyst-commits mailing list