X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FMethod%2FConstructor.pm;h=966731e65afa271895ff9e7406e33b50ddf42b06;hb=0bfc85b88523ddd75e0868d6ec1244f4365bda07;hp=df1d5c273ccd88bd60ad72c41523f904cdbbc166;hpb=26ffbb36c3741396b796f1049a86b87cb8319c0d;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Method/Constructor.pm b/lib/Class/MOP/Method/Constructor.pm index df1d5c2..966731e 100644 --- a/lib/Class/MOP/Method/Constructor.pm +++ b/lib/Class/MOP/Method/Constructor.pm @@ -23,7 +23,7 @@ sub new { ($options{package_name} && $options{name}) || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT"; - my $self = $class->_new(%options); + my $self = $class->_new(\%options); # we don't want this creating # a cycle in the code, if not @@ -36,17 +36,18 @@ sub new { } sub _new { - my ( $class, %options ) = @_; + my $class = shift; + my $options = @_ == 1 ? $_[0] : {@_}; bless { # from our superclass 'body' => undef, - 'package_name' => $options{package_name}, - 'name' => $options{name}, + 'package_name' => $options->{package_name}, + 'name' => $options->{name}, # specific to this subclass - 'options' => $options{options} || {}, - 'associated_metaclass' => $options{metaclass}, - 'is_inline' => ($options{is_inline} || 0), + 'options' => $options->{options} || {}, + 'associated_metaclass' => $options->{metaclass}, + 'is_inline' => ($options->{is_inline} || 0), }, $class; }