[Catalyst-commits] r9543 - Catalyst-Runtime/5.80/branches/add_captures_to_visit/lib/Catalyst

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Sat Mar 21 15:56:08 GMT 2009


Author: t0m
Date: 2009-03-21 15:56:08 +0000 (Sat, 21 Mar 2009)
New Revision: 9543

Modified:
   Catalyst-Runtime/5.80/branches/add_captures_to_visit/lib/Catalyst/Dispatcher.pm
Log:
Hack _invoke_as_component in a horrible way, so that it gives us back a path Action if it can, which makes >visit work correctly with qw/MyApp::Controller::Chained method_name/. I feel dirty, but it makes the test pass..

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:54:33 UTC (rev 9542)
+++ Catalyst-Runtime/5.80/branches/add_captures_to_visit/lib/Catalyst/Dispatcher.pm	2009-03-21 15:56:08 UTC (rev 9543)
@@ -320,6 +320,17 @@
 
     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 );
+        return $possible_action if $possible_action;
+    }
+
     if ( my $code = $class->can($method) ) {
         return $self->_method_action_class->new(
             {




More information about the Catalyst-commits mailing list