X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatcher.pm;h=490f549e558dc868fd8b4ab998fc9e609f002aeb;hb=540966c1cceb83d76a1648209ec53c1ef7aa3234;hp=745f84f713f82d90de05f27f05bc48634c0ac22e;hpb=2c68dfce1dc4c37623e2a8184efe856e38dedc1a;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 745f84f..490f549 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -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( { @@ -260,11 +258,11 @@ sub get_containers { # should catch any failures - or short-circuit this if this *is* a # bug in the visitor and gets fixed. - my $extra = $path[ ( scalar @match ) - 1 ]; - last unless $extra; - $visitor->setSearchPath($extra); - $match[-1]->accept($visitor); - push( @match, $visitor->getResult ) if defined $visitor->getResult; + if (my $extra = $path[ ( scalar @match ) - 1 ]) { + $visitor->setSearchPath($extra); + $match[-1]->accept($visitor); + push( @match, $visitor->getResult ) if defined $visitor->getResult; + } } return map { $_->getNodeValue } @match;