X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatcher.pm;h=c3ae86537478cf49e13f536476878975543653cb;hb=8f5912113dcd6b0dcd152cfa593fae67cf991ccc;hp=861d5ef4f9b9f38ace5d5bda957a3c078d614660;hpb=f05af9ba770db5ada00fc0fb593560f39cc6b817;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 861d5ef..c3ae865 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -137,7 +137,7 @@ sub forward { my $class = $command || ''; if ( $class =~ /[^\w\:]/ ) { - my $error = qq/Couldn't forward to "$class"/; + my $error = qq/"$class" is an invalid Class name/; $c->error($error); $c->log->debug($error) if $c->debug; return 0; @@ -145,13 +145,14 @@ sub forward { my $method = shift || 'process'; + require $class; if ( my $code = $class->can($method) ) { $c->actions->{reverse}->{"$code"} = "$class->$method"; $results = [ [ [ $class, $code ] ] ]; } else { - my $error = qq/Couldn't forward to "$class"/; + my $error = qq/Couldn't forward to "$class". Does not implement "$method"/; $c->error($error); $c->log->debug($error) if $c->debug; @@ -235,13 +236,7 @@ sub get_action { my $name = $c->actions->{compiled}->[$i]->[0]; my $regex = $c->actions->{compiled}->[$i]->[1]; - if ( $action =~ $regex ) { - my @snippets; - for my $i ( 1 .. 9 ) { - no strict 'refs'; - last unless ${$i}; - push @snippets, ${$i}; - } + if ( my @snippets = ( $action =~ $regex ) ) { return [ [ $c->actions->{regex}->{$name}, $name, \@snippets ] ]; }