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 {
# 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) = @_;
# 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 ) ) {
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;