From: gfx Date: Sat, 28 Nov 2009 01:20:25 +0000 (+0900) Subject: Fix meta method constructors X-Git-Tag: 0.40_09~26 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e78cd29d5fc15e8772735b0e4691549dd685d689;p=gitmo%2FMouse.git Fix meta method constructors --- diff --git a/lib/Mouse/Meta/Method.pm b/lib/Mouse/Meta/Method.pm index dab9592..9ba243e 100755 --- a/lib/Mouse/Meta/Method.pm +++ b/lib/Mouse/Meta/Method.pm @@ -13,11 +13,13 @@ sub wrap{ } sub _new{ - my $class = shift; - return $class->meta->new_object(@_) - if $class ne __PACKAGE__; + my($class, %args) = @_; + my $self = bless \%args, $class; - return bless {@_}, $class; + if($class ne __PACKAGE__){ + $self->meta->_initialize_object($self, \%args); + } + return $self; } sub body { $_[0]->{body} } diff --git a/lib/Mouse/Meta/Role/Method.pm b/lib/Mouse/Meta/Role/Method.pm index 126bf50..02cff34 100755 --- a/lib/Mouse/Meta/Role/Method.pm +++ b/lib/Mouse/Meta/Role/Method.pm @@ -4,11 +4,14 @@ use Mouse::Util; # enables strict and warnings use Mouse::Meta::Method; our @ISA = qw(Mouse::Meta::Method); -sub _new { - my $class = shift; - return $class->meta->new_object(@_) - if $class ne __PACKAGE__; - return bless {@_}, $class; +sub _new{ + my($class, %args) = @_; + my $self = bless \%args, $class; + + if($class ne __PACKAGE__){ + $self->meta->_initialize_object($self, \%args); + } + return $self; } 1;