From: Matt S Trout Date: Wed, 2 Nov 2005 01:59:07 +0000 (+0000) Subject: - Made forward use $c->component($command) instead of $c->components->{$command}... X-Git-Tag: 5.7099_04~1054 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d6e0d7e606b6789fab9a1879a75497d8bbcf7941;hp=5ee249f25d549a71fdb509af9d99151f62cddab8;p=catagits%2FCatalyst-Runtime.git - Made forward use $c->component($command) instead of $c->components->{$command} for fallback --- diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 851a3b0..966a4e2 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -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, diff --git a/t/live/lib/TestApp/Controller/Action/Forward.pm b/t/live/lib/TestApp/Controller/Action/Forward.pm index 02ce255..56a50f1 100644 --- a/t/live/lib/TestApp/Controller/Action/Forward.pm +++ b/t/live/lib/TestApp/Controller/Action/Forward.pm @@ -25,7 +25,7 @@ sub four : Private { sub five : Local { my ( $self, $c ) = @_; - $c->forward('TestApp::View::Dump::Request'); + $c->forward('View::Dump::Request'); } sub jojo : Local {