summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/MooseX/NonMoose.pm3
-rw-r--r--t/005-moose.t8
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/MooseX/NonMoose.pm b/lib/MooseX/NonMoose.pm
index 1d76f52..b2c6037 100644
--- a/lib/MooseX/NonMoose.pm
+++ b/lib/MooseX/NonMoose.pm
@@ -33,6 +33,9 @@ sub extends {
# no reason to install a new one
return if $constructor_class_meta->can('does_role')
&& $constructor_class_meta->does_role('MooseX::NonMoose::Meta::Role::Constructor');
+ # if the constructor we're inheriting is an inlined version of the
+ # default moose constructor, don't do anything either
+ return if $constructor_class_meta->name eq 'Moose::Meta::Method::Constructor';
}
$caller_meta->add_method(new => sub {
diff --git a/t/005-moose.t b/t/005-moose.t
index 64b3c8f..80bb87f 100644
--- a/t/005-moose.t
+++ b/t/005-moose.t
@@ -40,8 +40,8 @@ package main;
my $foo_othersub = Foo::OtherSub->new;
isa_ok $foo_othersub, 'Foo';
is $foo_othersub->foo, 'FOO', 'inheritance works (immutable when extending)';
-ok(Foo::OtherSub->meta->has_method('new'),
- 'Foo::OtherSub has its own inlined constructor (immutable when extending)');
+ok(!Foo::OtherSub->meta->has_method('new'),
+ 'Foo::OtherSub doesn\'t have its own new method (immutable when extending)');
ok(!Foo::OtherSub->meta->constructor_class->meta->isa('Moose::Meta::Class'),
'Foo::OtherSub\'s constructor class hasn\'t had any roles applied to it (immutable when extending)');
@@ -49,7 +49,7 @@ Foo::OtherSub->meta->make_immutable;
$foo_othersub = Foo::OtherSub->new;
isa_ok $foo_othersub, 'Foo';
is $foo_othersub->foo, 'FOO', 'inheritance works (all immutable)';
-ok(Foo::OtherSub->meta->has_method('new'),
- 'Foo::OtherSub has its own inlined constructor (all immutable)');
+ok(!Foo::OtherSub->meta->has_method('new'),
+ 'Foo::OtherSub doesn\'t have its own new method (all immutable)');
ok(!Foo::OtherSub->meta->constructor_class->meta->isa('Moose::Meta::Class'),
'Foo::OtherSub\'s constructor class hasn\'t had any roles applied to it (all immutable)');