[Catalyst] Re: Chained and exceptions

Bill Moseley moseley at hank.org
Thu May 9 20:42:28 GMT 2013


On Thu, May 9, 2013 at 9:34 AM, Aristotle Pagaltzis <pagaltzis at gmx.de>wrote:

> * Bill Moseley <moseley at hank.org> [2013-05-09 15:30]:
> > What's the reasoning that chained actions continue to run after an
> > earlier exception?
>
> Seems like an accident of the design to me, borderline bug.
>

Agreed.  Seems like something that could be easily overlooked.


>
> If like me you don=92t like it, Catalyst::ActionRole::DetachOnDie
>

Oh, that's nice.   Tricks for applying it globally?


I went the monkey patch route.  Shield your eyes:

use Catalyst::ActionChain;
sub Catalyst::ActionChain::dispatch {
    my ( $self, $c ) =3D @_;
    my @captures =3D @{$c->req->captures||[]};
    my @chain =3D @{ $self->chain };
    my $last =3D pop(@chain);
    foreach my $action ( @chain ) {
        my @args;
        if (my $cap =3D $action->number_of_captures) {
          @args =3D splice(@captures, 0, $cap);
        }
        local $c->request->{arguments} =3D \@args;
        $action->dispatch( $c );

       * return if @{ $c->error };  # Patch*
    }
    $last->dispatch( $c );
}



-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20130509/96c4f=
9e3/attachment.htm


More information about the Catalyst mailing list