Switched to Text::SimpleTable
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Dispatcher.pm
index 5d92eb2..d92c7dc 100644 (file)
@@ -112,7 +112,9 @@ sub forward {
 
     unless ( $result ) {
 
-        unless ( $c->components->{$command} ) {
+        my $comp;
+
+        unless ( $comp = $c->component($command) ) {
             my $error =
 qq/Couldn't forward to command "$command". Invalid action or component./;
             $c->error($error);
@@ -120,10 +122,10 @@ qq/Couldn't forward to command "$command". Invalid action or component./;
             return 0;
         }
 
-        my $class  = $command;
+        my $class  = ref $comp;
         my $method = shift || 'process';
 
-        if ( my $code = $c->components->{$class}->can($method) ) {
+        if ( my $code = $class->can($method) ) {
             my $action = Catalyst::Action->new(
                 {
                     name      => $method,
@@ -148,7 +150,6 @@ qq/Couldn't forward to command "$command". Invalid action or component./;
     }
 
     local $c->request->{arguments} = [ @{$arguments} ];
-    local $c->{namespace} = $result->namespace;
 
     $result->execute($c);
 
@@ -393,6 +394,7 @@ sub setup_actions {
 =head1 AUTHOR
 
 Sebastian Riedel, C<sri@cpan.org>
+Matt S Trout, C<mst@shadowcatsystems.co.uk>
 
 =head1 COPYRIGHT