X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FDispatcher.pm;h=ca6c0eece0be6f03956d479974f56416a376506a;hp=1f0dea9b122fb3f25e962c97e40697a2951ecc46;hb=1f6bb7993ce667b329e9bcb6d9d3f3a7f947b398;hpb=c74caf1d4e65d9d142e350f158828340483ac3ab diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 1f0dea9..ca6c0ee 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -148,36 +148,24 @@ sub forward { my $results = $c->get_action( $command, $namespace ); unless ( @{$results} ) { - my $class = $command || ''; - my $path = $class . '.pm'; - $path =~ s/::/\//g; - - unless ( $INC{$path} ) { - my $error = - qq/Couldn't forward to "$class". Invalid or not loaded./; + + unless ( $c->components->{$command} ) { + my $error = qq/Couldn't forward to command "$command". Invalid action or component./; $c->error($error); $c->log->debug($error) if $c->debug; return 0; } - - unless ( UNIVERSAL::isa( $class, 'Catalyst::Base' ) ) { - my $error = - qq/Can't forward to "$class". Class is not a Catalyst component./; - $c->error($error); - $c->log->debug($error) if $c->debug; - return 0; - } - + + my $class = $command; my $method = shift || 'process'; - if ( my $code = $class->can($method) ) { + if ( my $code = $c->components->{$class}->can($method) ) { $c->actions->{reverse}->{"$code"} = "$class->$method"; $results = [ [ [ $class, $code ] ] ]; } else { - my $error = - qq/Couldn't forward to "$class". Does not implement "$method"/; + my $error = qq/Couldn't forward to "$class". Does not implement "$method"/; $c->error($error); $c->log->debug($error) if $c->debug;