X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FObject.pm;h=b16b733f4899190da7eb7f619c041f78d2d02c7e;hb=a4f5ff60abecb1aec3e40b4e97c4c955d34eb326;hp=6aee996682410974bba34ef9caae8137a1d61324;hpb=c310bfa05ac3defa413ad464e0c0350cab908995;p=gitmo%2FMoose.git diff --git a/lib/Moose/Object.pm b/lib/Moose/Object.pm index 6aee996..b16b733 100644 --- a/lib/Moose/Object.pm +++ b/lib/Moose/Object.pm @@ -12,21 +12,17 @@ use Try::Tiny (); use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class'; use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class'; -our $VERSION = '0.94'; +our $VERSION = '1.11'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; sub new { my $class = shift; - - my $params = $class->BUILDARGS(@_); - my $real_class = Scalar::Util::blessed($class) || $class; - my $self = Class::MOP::Class->initialize($real_class)->new_object($params); - $self->BUILDALL($params); + my $params = $real_class->BUILDARGS(@_); - return $self; + return Class::MOP::Class->initialize($real_class)->new_object($params); } sub BUILDARGS { @@ -48,16 +44,13 @@ sub BUILDALL { # NOTE: we ask Perl if we even # need to do this first, to avoid # extra meta level calls - return if $_[0]->can('BUILD') == \&BUILD; + return unless $_[0]->can('BUILD'); my ($self, $params) = @_; foreach my $method (reverse Class::MOP::class_of($self)->find_all_methods_by_name('BUILD')) { - next if $method->{class} eq __PACKAGE__; $method->{code}->execute($self, $params); } } -sub BUILD { } - sub DEMOLISHALL { my $self = shift; my ($in_global_destruction) = @_; @@ -65,7 +58,7 @@ sub DEMOLISHALL { # NOTE: we ask Perl if we even # need to do this first, to avoid # extra meta level calls - return if $self->can('DEMOLISH') == \&DEMOLISH; + return unless $self->can('DEMOLISH'); my @isa; if ( my $meta = Class::MOP::class_of($self ) ) { @@ -81,15 +74,12 @@ sub DEMOLISHALL { foreach my $class (@isa) { no strict 'refs'; - next if $class eq __PACKAGE__; my $demolish = *{"${class}::DEMOLISH"}{CODE}; $self->$demolish($in_global_destruction) if defined $demolish; } } -sub DEMOLISH { } - sub DESTROY { my $self = shift;