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

marcus at dev.catalyst.perl.org marcus at dev.catalyst.perl.org
Thu Jun 26 17:30:57 BST 2008


Author: marcus
Date: 2008-06-26 17:30:56 +0100 (Thu, 26 Jun 2008)
New Revision: 8009

Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm
   Catalyst-Runtime/5.80/trunk/t/unit_core_action_for.t
Log:
Add stringify back for action, and test

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2008-06-26 14:07:55 UTC (rev 8008)
+++ Catalyst-Runtime/5.80/trunk/Changes	2008-06-26 16:30:56 UTC (rev 8009)
@@ -1,5 +1,9 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+5.8000
+        - Port to Moose
+        - Added test for action stringify
+
 5.7013
         - Fix subdirs for scripts that run in subdirs more than one level deep.
         - Added test and updated docs for handling the Authorization header

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm	2008-06-26 14:07:55 UTC (rev 8008)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm	2008-06-26 16:30:56 UTC (rev 8009)
@@ -28,6 +28,21 @@
 
 no Moose;
 
+use overload (
+
+    # Stringify to reverse for debug output etc.
+    q{""} => sub { shift->{reverse} },
+
+    # Codulate to execute to invoke the encapsulated action coderef
+    '&{}' => sub { my $self = shift; sub { $self->execute(@_); }; },
+
+    # Make general $stuff still work
+    fallback => 1,
+
+);
+
+
+
 no warnings 'recursion';
 
 #__PACKAGE__->mk_accessors(qw/class namespace reverse attributes name code/);

Modified: Catalyst-Runtime/5.80/trunk/t/unit_core_action_for.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_core_action_for.t	2008-06-26 14:07:55 UTC (rev 8008)
+++ Catalyst-Runtime/5.80/trunk/t/unit_core_action_for.t	2008-06-26 16:30:56 UTC (rev 8009)
@@ -8,7 +8,7 @@
 
 use Test::More;
 
-plan tests => 3;
+plan tests => 4;
 
 use_ok('TestApp');
 
@@ -18,3 +18,6 @@
 is(TestApp->controller('Args')->action_for('args')->code,
    TestApp::Controller::Args->can('args'),
    'action_for on controller ok');
+   is(TestApp->controller('Args')->action_for('args').'',
+      'args/args',
+      'action stringifies');




More information about the Catalyst-commits mailing list