summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-04-10 02:17:05 -0500
committerdoy <doy@tozt.net>2009-04-10 02:17:05 -0500
commit905935092f4be848a98e186a8b7009e220365d9b (patch)
tree915d1d16d5769d42642b719da2bf8c13eff70e3e /lib
parent9c80a3d3f83f9d7f09d001564d6352238e871ebf (diff)
downloadmoosex-nonmoose-905935092f4be848a98e186a8b7009e220365d9b.tar.gz
moosex-nonmoose-905935092f4be848a98e186a8b7009e220365d9b.zip
hmmm, this conditional wasn't doing anything and tests still pass, so...? probably look more into this
Diffstat (limited to 'lib')
-rw-r--r--lib/MooseX/NonMoose.pm43
1 files changed, 20 insertions, 23 deletions
diff --git a/lib/MooseX/NonMoose.pm b/lib/MooseX/NonMoose.pm
index db2e385..926dc69 100644
--- a/lib/MooseX/NonMoose.pm
+++ b/lib/MooseX/NonMoose.pm
@@ -15,29 +15,26 @@ sub extends_nonmoose {
Moose::extends($caller, @superclasses);
- my $meta = Class::MOP::Class->initialize($caller);
- if ($meta->find_next_method_by_name('new')->body ne \&constructor) {
- $meta->add_method(new => sub {
- my $class = shift;
- my $meta = Class::MOP::Class->initialize($class);
-
- # we need to get the non-moose constructor from the superclass
- # of the class where this method actually exists
- my $caller_meta = Class::MOP::Class->initialize($caller);
- my $super_new = $caller_meta->find_next_method_by_name('new');
- # but we need to call it as a method on the class we're actually
- # trying to instantiate
- my $self = $super_new->execute($class, @_);
-
- my $params = $class->BUILDARGS(@_);
- my $moose_self = $meta->new_object(
- __INSTANCE__ => $self,
- %$params,
- );
- $moose_self->BUILDALL($params);
- return $moose_self;
- });
- }
+ my $caller_meta = Class::MOP::Class->initialize($caller);
+ $caller_meta->add_method(new => sub {
+ my $class = shift;
+ my $meta = Class::MOP::Class->initialize($class);
+
+ # we need to get the non-moose constructor from the superclass
+ # of the class where this method actually exists
+ my $super_new = $caller_meta->find_next_method_by_name('new');
+ # but we need to call it as a method on the class we're actually
+ # trying to instantiate
+ my $self = $super_new->execute($class, @_);
+
+ my $params = $class->BUILDARGS(@_);
+ my $moose_self = $meta->new_object(
+ __INSTANCE__ => $self,
+ %$params,
+ );
+ $moose_self->BUILDALL($params);
+ return $moose_self;
+ });
}
sub init_meta {