From eaf615a6387b9cf4202f9fd1d5f64225c4a06200 Mon Sep 17 00:00:00 2001 From: doy Date: Sat, 11 Apr 2009 00:28:08 -0500 Subject: comments --- lib/MooseX/NonMoose.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/MooseX/NonMoose.pm b/lib/MooseX/NonMoose.pm index 240fcb4..0db4fb6 100644 --- a/lib/MooseX/NonMoose.pm +++ b/lib/MooseX/NonMoose.pm @@ -17,7 +17,8 @@ sub extends { my $caller_meta = Class::MOP::Class->initialize($caller); # we need to get the non-moose constructor from the superclass - # of the class where this method actually exists + # of the class where this method actually exists, regardless of what class + # we're calling it on my $super_new = $caller_meta->find_next_method_by_name('new'); if ($super_new->associated_metaclass->can('constructor_class')) { @@ -25,6 +26,8 @@ sub extends { $super_new->associated_metaclass->constructor_class ); + # if the constructor we're inheriting is already one of ours, there's + # 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'); } -- cgit v1.2.3-54-g00ecf