1 package Catalyst::ActionContainer;
5 Catalyst::ActionContainer - Catalyst Action Container
13 This is a container for actions. The dispatcher sets up a tree of these
14 to represent the various dispatch points in your application.
23 # Stringify to path part for tree search
24 q{""} => sub { shift->part },
28 has part => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
29 has actions => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
34 my ($self, $params) = @_;
35 $params = { part => $params } unless ref $params;
36 $self->next::method($params);
41 my ( $self, $name ) = @_;
42 return $self->actions->{$name} if defined $self->actions->{$name};
47 my ( $self, $action, $name ) = @_;
48 $name ||= $action->name;
49 $self->actions->{$name} = $action;
52 __PACKAGE__->meta->make_immutable;
60 =head2 new(\%data | $part)
62 Can be called with { part => $part, actions => \%actions } for full
63 construction or with just a part, which will result in an empty actions
64 hashref to be populated via add_action later
66 =head2 get_action($name)
68 Returns an action from this container based on the action name, or undef
70 =head2 add_action($action, [ $name ])
72 Adds an action, optionally providing a name to override $action->name
76 Accessor to the actions hashref, containing all actions in this container.
80 Accessor to the path part this container resolves to. Also what the container
93 This program is free software, you can redistribute it and/or modify it under
94 the same terms as Perl itself.