Separated execute and dispatch on Catalyst::Action
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Dispatcher.pm
index e330047..c03f1b3 100644 (file)
@@ -159,7 +159,7 @@ sub forward {
     #push @$args, @_;
 
     local $c->request->{arguments} = $args;
-    $action->execute($c);
+    $action->dispatch( $c );
 
     return $c->state;
 }
@@ -287,19 +287,20 @@ sub get_action {
     my ( $self, $name, $namespace ) = @_;
     return unless $name;
 
-    $namespace = join("/", grep { length } split '/', $namespace || "" );
+    $namespace = join( "/", grep { length } split '/', $namespace || "" );
 
     return $self->action_hash->{"$namespace/$name"};
 }
 
-=head2 $self->get_action_by_path( $path );
+=head2 $self->get_action_by_path( $path ); 
+   
+Returns the named action by its full path. 
 
-returns the named action by it's full path.
-
-=cut
+=cut 
 
 sub get_action_by_path {
     my ( $self, $path ) = @_;
+    $path = "/$path" unless $path =~ /\//;
     $self->action_hash->{$path};
 }
 
@@ -311,7 +312,7 @@ sub get_actions {
     my ( $self, $c, $action, $namespace ) = @_;
     return [] unless $action;
 
-    $namespace = join("/", grep { length } split '/', $namespace || "" );
+    $namespace = join( "/", grep { length } split '/', $namespace || "" );
 
     my @match = $self->get_containers($namespace);
 
@@ -331,9 +332,11 @@ sub get_containers {
 
     my @containers;
 
-    do {
-        push @containers, $self->container_hash->{$namespace};
-    } while ( $namespace =~ s#/[^/]+$## );
+    if ( length $namespace ) {
+        do {
+            push @containers, $self->container_hash->{$namespace};
+        } while ( $namespace =~ s#/[^/]+$## );
+    }
 
     return reverse grep { defined } @containers, $self->container_hash->{''};
 
@@ -439,7 +442,7 @@ sub setup_actions {
 
     my $privates = Text::SimpleTable->new(
         [ 20, 'Private' ],
-        [ 38, 'Class' ],
+        [ 36, 'Class' ],
         [ 12, 'Method' ]
     );