plucky (3) Catalyst::ActionChain.3pm.gz

Provided by: libcatalyst-perl_5.90132-1_all bug

NAME

       Catalyst::ActionChain - Chain of Catalyst Actions

SYNOPSIS

       See Catalyst::Manual::Intro for more info about Chained actions.

DESCRIPTION

       This class represents a chain of Catalyst Actions. It behaves exactly like the action at the *end* of the
       chain except on dispatch it will execute all the actions in the chain in order.

METHODS

   chain
       Accessor for the action chain; will be an arrayref of the Catalyst::Action objects encapsulated by this
       chain.

   dispatch( $c )
       Dispatch this action chain against a context; will dispatch the encapsulated actions in order.

   from_chain( \@actions )
       Takes a list of Catalyst::Action objects and constructs and returns a Catalyst::ActionChain object
       representing a chain of these actions

   number_of_captures
       Returns the total number of captures for the entire chain of actions.

   match_captures
       Match all the captures that this chain encloses, if any.

   scheme
       Any defined scheme for the actionchain

   next ( @args)
       Dispatches to the next action in the chain immediately, suspending any remaining code in the action.  If
       there are no more actions in the chain, this is basically a no-op.  When the last action in the chain
       returns, we will return to the last action that called next and continue processing that action's code
       exactly where it was left off. If more than one action in the chain called "next" then we proceed back up
       the chain stack in reverse order of calls after the last action completes.

       The return value of "next" is the return value of the next action in the chain (that is the action that
       was called with "next") or whatever $c->state is set to.

       Please note that since "state" is a scalar, you cannot return a list of values from an action chain.  If
       you want to return a list you must return an arrayref or hashref.  This limitation is due to longstanding
       code in Catalyst that is not easily changed without breaking backwards compatibility.

       You can call "next" in as many actions in a long chain as you want and the chain will correctly return to
       the last action that called "next" based on order of execution.  If there are actions inbetween that
       didn't call "next", those will be skipped when proceeding back up the call stack.  When we've completed
       walking back up the action call stack the dispatcher will then return to normal processing order (for
       example processing any "end" action present).

       Any arguments you pass to "next" will be passed to the next action in the chain as
       "$c->request->arguments".  You can pass more than one argument.  All arguments passed via "next" will be
       added into the argument list prior to any CaptureArgs or Args that the action itself defines.

       Example:

           sub action_a :Chained('/') CaptureArgs(0) {
             my ($self, $ctx) = @_;
             my $abc = $c->action->next('a'); # $abc = "abc";
           }

           sub action_b :Chained('action_a') CaptureArgs(0) {
             my ($self, $ctx, $a) = @_;
             my $abc = $c->action->next("${a}b");
             return $abc;
           }

           sub action_c :Chained('action_b') Args(0) {
             my ($self, $ctx, $ab) = @_;
             return "${ab}c";
           }

   meta
       Provided by Moose

AUTHORS

       Catalyst Contributors, see Catalyst.pm

       This library is free software. You can redistribute it and/or modify it under the same terms as Perl
       itself.