package Catalyst::ActionContainer;
-use strict;
-use base qw/Class::Accessor::Fast/;
-
=head1 NAME
Catalyst::ActionContainer - Catalyst Action Container
=cut
-__PACKAGE__->mk_accessors(qw/part actions/);
-
-use overload (
-
- # Stringify to path part for tree search
- q{""} => sub { shift->{part} },
-
-);
+use Moose;
+with 'MooseX::Emulate::Class::Accessor::Fast';
-sub new {
- my ( $class, $fields ) = @_;
+has part => (is => 'rw', required => 1);
+has actions => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
- $fields = { part => $fields, actions => {} } unless ref $fields;
-
- $class->SUPER::new($fields);
-}
+around new => sub {
+ my ($orig, $self, $params) = @_;
+ $orig->($self, (ref($params) ? $params : { part => $params } ));
+};
+no Moose;
+use overload (
+ # Stringify to path part for tree search
+ q{""} => sub { shift->part },
+);
sub get_action {
my ( $self, $name ) = @_;
$self->actions->{$name} = $action;
}
+__PACKAGE__->meta->make_immutable;
+
1;
__END__
Accessor to the path part this container resolves to. Also what the container
stringifies to.
-=head1 AUTHOR
+=head2 meta
+
+Provided by Moose
+
+=head1 AUTHORS
-Matt S. Trout
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT