From 5a83002a3790db2565278c5b8085631b5e3172b3 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 29 May 2009 00:23:27 -0500 Subject: fix the check for the constructor being intact --- lib/MooseX/ABC/Trait/Class.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/MooseX/ABC/Trait/Class.pm b/lib/MooseX/ABC/Trait/Class.pm index 6f4bf6c..b5388bf 100644 --- a/lib/MooseX/ABC/Trait/Class.pm +++ b/lib/MooseX/ABC/Trait/Class.pm @@ -41,7 +41,10 @@ around _immutable_options => sub { if ($self->has_required_methods) { push @options, inline_constructor => 0; } - elsif ($constructor->original_package_name eq 'MooseX::ABC::Role::Object') { + # we know that the base class has at least our base class role applied, + # so it's safe to replace it if there is only one wrapper. + elsif ($constructor->isa('Class::MOP::Method::Wrapped') + && $constructor->get_original_method == Class::MOP::class_of('Moose::Object')->get_method('new')) { push @options, replace_constructor => 1; } return @options; -- cgit v1.2.3