[Catalyst] returning false in auto action does not break chain

Edmund von der Burg evdb at ecclestoad.co.uk
Sat May 14 16:03:17 CEST 2005


I am trying to break out of the processing chain by returning 0 in the 
'auto' action. However the chain is still processed. I have simplified 
the auto to:

# In Scrpbk::C::Scrap
sub auto : Private {
    my ( $self, $c ) = @_;
    warn 'Return 0';
    return 0;

When I request a page I get in the logs:

Return 0 at /usr/local/sandbox/Scrpbk/script/../lib/Scrpbk/C/Scrap.pm line 10.
| Action                                                           | Time      |
| /begin                                                           | 0.000039s |
| /scrap/auto                                                      | 0.000280s |
| /scrap/edit                                                      | 0.063021s |
| -> Scrpbk::V::TT->process                                        | 0.202744s |
| /end                                                             | 0.203326s |

This conficts with the documented behaviour in 'Catalyst::Manual::Intro':

  Also, if you need to break out of the chain in one of your auto
  actions, you can return 0, if so, your action will not be processed,
  but the end will, so for the request above, if the first auto returns
  false, it would look like this:

>From a brief look at the source in Catalyst::Dispatcher there does not 
appear to be any checking of auto's return value.

Could I suggest that all actions should return true to continue 
processing. Returning false would lead to the end actions beng processed 
immediately. Perhaps this should become an optional behavior to be set 
in config:

  actions_must_return_true => 1,


 ***  Edmund von der Burg  <evdb at ecclestoad.co.uk>       ***
 ***                                                     ***
 ***  websites: http://ecclestoad.co.uk                  ***
 ***            http://scrpbk.com/~evdb                  ***

More information about the Catalyst mailing list