Catalyst::ActionRole::DetachOnDie - If something dies in a chain, stop the chain. DEPRECATED IN FAVOR OF CATALYST 5.90040
version 0.001006
package MyApp::Controller::Foo; use Moose; BEGIN { extends 'Catalyst::Controller::ActionRole' } __PACKAGE__->config( action => { '*' => { Does => 'DetachOnDie' }, }, ); ...;
Chained dispatch is arguably one of the coolest features Catalyst has to offer, unfortunately it is marred by the bizarre decision to have exceptions thrown not detach a chain. To be clear, if one has a chain as follows:
sub first : Chained('/') PathPart('') CaptureArgs(0) { ... } sub middle : Chained('first') PathPart('middle') CaptureArgs(0) { ... } sub last : Chained('middle') PathPart('') Args(0) { ... }
If the URL /middle is dispatched to, but an exception is raised in the middle (or even first) method, the last method will still run! This module solves that problem. I recommend you use it as I have documented in the "SYNOPSIS", as that will make it apply to all of your actions, but if for some reason you do not want to apply it to all actions you can apply it per action as follows:
middle
first
last
sub foo : Chained('bar') PathPart('') CaptureArgs(0) Does('DetachOnDie') { ... }
If you do not want to use the action role, check out Catalyst::Action::DetachOnDie, which does the same thing but does not require the use of Catalyst::Controller::ActionRole.
Instead of using this module you should use Catalyst 5.90040 and set the abort_chain_on_error_fix flag.
abort_chain_on_error_fix
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
This software is copyright (c) 2013 by Arthur Axel "fREW" Schmidt.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Catalyst::ActionRole::DetachOnDie, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::ActionRole::DetachOnDie
CPAN shell
perl -MCPAN -e shell install Catalyst::ActionRole::DetachOnDie
For more information on module installation, please visit the detailed CPAN module installation guide.