[Catalyst-commits] r9544 - in Catalyst-Runtime/5.80/branches/add_captures_to_visit: lib/Catalyst t/aggregate t/lib/TestApp/Controller/Action

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Sat Mar 21 18:04:07 GMT 2009


Author: t0m
Date: 2009-03-21 18:04:06 +0000 (Sat, 21 Mar 2009)
New Revision: 9544

Modified:
   Catalyst-Runtime/5.80/branches/add_captures_to_visit/lib/Catalyst/Dispatcher.pm
   Catalyst-Runtime/5.80/branches/add_captures_to_visit/t/aggregate/live_component_controller_action_visit.t
   Catalyst-Runtime/5.80/branches/add_captures_to_visit/t/lib/TestApp/Controller/Action/Visit.pm
Log:
Much cleaner. The visit class test wasn't actually testing visiting the class, so I fixed that and made the English in the error message more correct (IMO)

Modified: Catalyst-Runtime/5.80/branches/add_captures_to_visit/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/add_captures_to_visit/lib/Catalyst/Dispatcher.pm	2009-03-21 15:56:08 UTC (rev 9543)
+++ Catalyst-Runtime/5.80/branches/add_captures_to_visit/lib/Catalyst/Dispatcher.pm	2009-03-21 18:04:06 UTC (rev 9544)
@@ -190,7 +190,7 @@
     }
     elsif (!defined $action->namespace) {
         $error .= qq/Action has no namespace: cannot $opname() to a plain /
-                 .qq/method or component, must be a :Action or some sort./
+                 .qq/method or component, must be an :Action of some sort./
     }
     elsif (!$action->class->can('_DISPATCH')) {
         $error .= qq/Action cannot _DISPATCH. /
@@ -320,14 +320,8 @@
 
     my $class = $self->_find_component_class( $c, $component ) || return 0;
 
-    ### XXX FIXME - Horrible hack to get proper action objects for
-    ###             controller paths..
-    if ($class =~ /::C(ontroller)?::/) {
-        my $possible_path = $class . '/' . $method;
-        $possible_path =~ s/.+::C(ontroller)?:://;
-        $possible_path =~ s|::|/|g;
-        $possible_path =~ tr/A-Z/a-z/;
-        my $possible_action = $self->_invoke_as_path( $c, '/' . $possible_path );
+    if (my $code = $component_instance->can('action_for')) {
+        my $possible_action = $component_instance->$code($method);
         return $possible_action if $possible_action;
     }
 

Modified: Catalyst-Runtime/5.80/branches/add_captures_to_visit/t/aggregate/live_component_controller_action_visit.t
===================================================================
--- Catalyst-Runtime/5.80/branches/add_captures_to_visit/t/aggregate/live_component_controller_action_visit.t	2009-03-21 15:56:08 UTC (rev 9543)
+++ Catalyst-Runtime/5.80/branches/add_captures_to_visit/t/aggregate/live_component_controller_action_visit.t	2009-03-21 18:04:06 UTC (rev 9544)
@@ -253,7 +253,7 @@
         );
         ok( !$response->is_success, 'Response Fails' );
         is( $response->content,
-            q{FATAL ERROR: Couldn't visit("TestApp"): Action has no namespace: cannot visit() to a plain method or component, must be a :Action or some sort.},
+            q{FATAL ERROR: Couldn't visit("TestApp"): Action has no namespace: cannot visit() to a plain method or component, must be an :Action of some sort.},
             "Cannot visit app namespace"
         );
     }

Modified: Catalyst-Runtime/5.80/branches/add_captures_to_visit/t/lib/TestApp/Controller/Action/Visit.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/add_captures_to_visit/t/lib/TestApp/Controller/Action/Visit.pm	2009-03-21 15:56:08 UTC (rev 9543)
+++ Catalyst-Runtime/5.80/branches/add_captures_to_visit/t/lib/TestApp/Controller/Action/Visit.pm	2009-03-21 18:04:06 UTC (rev 9544)
@@ -98,7 +98,7 @@
 
 sub class_visit_test_action : Local {
     my ( $self, $c ) = @_;
-    $c->visit(qw/TestApp class_visit_test_method/);
+    $c->visit(qw/TestApp/);
 }
 
 1;




More information about the Catalyst-commits mailing list