NAME

Catalyst::ActionRole::DetachOnDie - If something dies in a chain, stop the chain. DEPRECATED IN FAVOR OF CATALYST 5.90040

VERSION

version 0.001006

SYNOPSIS

package MyApp::Controller::Foo;
use Moose;

BEGIN { extends 'Catalyst::Controller::ActionRole' }

__PACKAGE__->config(
   action => {
      '*' => { Does => 'DetachOnDie' },
   },
);

...;

DESCRIPTION

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:

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.

DEPRECATED

Instead of using this module you should use Catalyst 5.90040 and set the abort_chain_on_error_fix flag.

AUTHOR

Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>

COPYRIGHT AND LICENSE

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.