X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatcher.pm;h=d64b17eb4bf237df340391e403f93beca23f8c7d;hb=103f2d968b5a1a732c19c39ae03cdd9a44a96a4b;hp=f63267bfe22e8b21dea4bf254df8b5b2c75f9bf9;hpb=98d049efac171f40ddcd1553d033f8daf6145e7d;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index f63267b..d64b17e 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -239,7 +239,7 @@ Documented in L sub forward { my $self = shift; no warnings 'recursion'; - $self->_do_forward(forward => @_); + return $self->_do_forward(forward => @_); } sub _do_forward { @@ -261,6 +261,12 @@ sub _do_forward { no warnings 'recursion'; $action->dispatch( $c ); + #If there is an error, all bets off regarding state. Documentation + #Specifies that when you forward, if there's an error you must expect + #state to be 0. + if( @{ $c->error }) { + $c->state(0); + } return $c->state; } @@ -273,6 +279,7 @@ Documented in L sub detach { my ( $self, $c, $command, @args ) = @_; $self->_do_forward(detach => $c, $command, @args ) if $command; + $c->state(0); # Needed in order to skip any auto functions Catalyst::Exception::Detach->throw; }