From: Florian Ragwitz Date: Sat, 14 Feb 2009 05:57:23 +0000 (+0000) Subject: Make ActionContainer use BUILDARGS instead of wrapping the constructor. X-Git-Tag: 5.80001~104 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=4b991a945fba301723837ad7349de4e979a7eaa6 Make ActionContainer use BUILDARGS instead of wrapping the constructor. --- diff --git a/lib/Catalyst/ActionContainer.pm b/lib/Catalyst/ActionContainer.pm index 2e711d4..848f71a 100644 --- a/lib/Catalyst/ActionContainer.pm +++ b/lib/Catalyst/ActionContainer.pm @@ -21,9 +21,10 @@ with 'MooseX::Emulate::Class::Accessor::Fast'; has part => (is => 'rw', required => 1); has actions => (is => 'rw', required => 1, lazy => 1, default => sub { {} }); -around new => sub { - my ($orig, $self, $params) = @_; - $orig->($self, (ref($params) ? $params : { part => $params } )); +around BUILDARGS => sub { + my ($next, $self, @args) = @_; + unshift @args, 'part' if scalar @args == 1 && !ref $args[0]; + return $self->$next(@args); }; no Moose;