X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FActionContainer.pm;h=5be7292d2b9fae00c163d1110c46bde6184a9c2a;hb=076bfad34f09c72325edd07728137d9a018f3433;hp=ca36862d0d4874e57c2b871cb184e28d40d4b887;hpb=7f602cacde033db25d6b4f7080eb647b189a039b;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/ActionContainer.pm b/lib/Catalyst/ActionContainer.pm index ca36862..5be7292 100644 --- a/lib/Catalyst/ActionContainer.pm +++ b/lib/Catalyst/ActionContainer.pm @@ -17,25 +17,21 @@ to represent the various dispatch points in your application. use Moose; -use overload ( - - # Stringify to path part for tree search - q{""} => sub { shift->part }, - -); - -has part => (is => 'rw', required => 1, lazy => 1, default => sub { {} }); +has part => (is => 'rw', required => 1); has actions => (is => 'rw', required => 1, lazy => 1, default => sub { {} }); -around 'new' => sub { - my $next = shift; - my ($self, $params) = @_; - $params = { part => $params } unless ref $params; - $next->($self, $params); +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 ) = @_; return $self->actions->{$name} if defined $self->actions->{$name}; @@ -48,6 +44,8 @@ sub add_action { $self->actions->{$name} = $action; } +__PACKAGE__->meta->make_immutable; + 1; __END__ @@ -81,9 +79,9 @@ stringifies to. Provided by Moose -=head1 AUTHOR +=head1 AUTHORS -Matt S. Trout +Catalyst Contributors, see Catalyst.pm =head1 COPYRIGHT