1 package Catalyst::ActionChain;
4 use base qw/Catalyst::Action/;
6 __PACKAGE__->mk_accessors(qw/chain/);
10 # Stringify to reverse for debug output etc.
11 q{""} => sub { shift->{reverse} },
13 # Codulate to execute to invoke the encapsulated action coderef
14 '&{}' => sub { my $self = shift; sub { $self->execute(@_); }; },
16 # Make general $stuff still work
23 Catalyst::ActionChain - Chain of Catalyst Actions
31 This class represents a chain of Catalyst Actions. It behaves exactly like
32 the action at the *end* of the chain except on dispatch it will execute all
33 the actions in the chain in order.
39 Accessor for the action chain; will be an arrayref of the Catalyst::Action
40 objects encapsulated by this chain.
44 Dispatch this action chain against a context; will dispatch the encapsulated
50 my ( $self, $c ) = @_;
51 foreach my $action ( @{ $self->chain } ) {
52 $action->dispatch( $c );
56 =head2 from_chain( \@actions )
58 Takes a list of Catalyst::Action objects and constructs and returns a
59 Catalyst::ActionChain object representing a chain of these actions
64 my ( $self, $actions ) = @_;
65 my $final = $actions->[-1];
66 return $self->new({ %$final, chain => $actions });
75 This program is free software, you can redistribute it and/or modify it under
76 the same terms as Perl itself.