1 package Catalyst::ActionContainer;
4 use base qw/Class::Accessor::Fast/;
8 Catalyst::ActionContainer - Catalyst Action Container
16 This is a container for actions. The dispatcher sets up a tree of these
17 to represent the various dispatch points in your application.
21 __PACKAGE__->mk_accessors(qw/part actions/);
25 # Stringify to path part for tree search
26 q{""} => sub { shift->{part} },
31 my ( $class, $fields ) = @_;
33 $fields = { part => $fields, actions => {} } unless ref $fields;
35 $class->SUPER::new($fields);
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;
58 =head2 new(\%data | $part)
60 Can be called with { part => $part, actions => \%actions } for full
61 construction or with just a part, which will result in an empty actions
62 hashref to be populated via add_action later
64 =head2 get_action($name)
66 Returns an action from this container based on the action name, or undef
68 =head2 add_action($action, [ $name ])
70 Adds an action, optionally providing a name to override $action->name
74 Accessor to the actions hashref, containing all actions in this container.
78 Accessor to the path part this container resolves to. Also what the container
87 This program is free software, you can redistribute it and/or modify it under
88 the same terms as Perl itself.