- Further tweaks and added tests
Matt S Trout [Sun, 6 Nov 2005 20:00:01 +0000 (20:00 +0000)]
lib/Catalyst/Dispatcher.pm
t/live/lib/TestApp/Controller/Action/Forward.pm

index 745f84f..8c87b75 100644 (file)
@@ -117,9 +117,10 @@ sub forward {
 
     unless ($result) {
 
-        my $comp;
+        my $class  = ref($command) || ref($c->component($command));
+        my $method = shift || 'process';
 
-        unless ( $comp = (ref $command ? $command : $c->component($command)) ) {
+        unless ( $class ) {
             my $error =
 qq/Couldn't forward to command "$command". Invalid action or component./;
             $c->error($error);
@@ -127,9 +128,6 @@ qq/Couldn't forward to command "$command". Invalid action or component./;
             return 0;
         }
 
-        my $class  = ref $comp;
-        my $method = shift || 'process';
-
         if ( my $code = $class->can($method) ) {
             my $action = $self->method_action_class->new(
                 {
index 56a50f1..f966898 100644 (file)
@@ -15,7 +15,7 @@ sub two : Private {
 
 sub three : Local {
     my ( $self, $c ) = @_;
-    $c->forward('four');
+    $c->forward($self, 'four');
 }
 
 sub four : Private {
@@ -31,7 +31,7 @@ sub five : Local {
 sub jojo : Local {
     my ( $self, $c ) = @_;
     $c->forward('one');
-    $c->forward('three');
+    $c->forward($c->controller('Action::Forward'), 'three');
 }
 
 sub inheritance : Local {