From: Dave Rolsky Date: Fri, 10 Sep 2010 02:00:46 +0000 (-0500) Subject: Add replace_does option X-Git-Tag: 1.13~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dcdceb384ca3978e3b249145a259a74317d8ea9e;p=gitmo%2FMoose.git Add replace_does option Doc inline_does and replace_does options to make_immutable --- diff --git a/lib/Moose/Meta/Class.pm b/lib/Moose/Meta/Class.pm index 2fb4c67..47c7764 100644 --- a/lib/Moose/Meta/Class.pm +++ b/lib/Moose/Meta/Class.pm @@ -688,10 +688,10 @@ sub _inline_does { package_name => $self->name, ); - return unless $does->can_be_inlined; - - $self->add_method( 'does' => $does ); - $self->_add_inlined_method($does); + if ( $args{replace_does} or $does->can_be_inlined ) { + $self->add_method( 'does' => $does ); + $self->_add_inlined_method($does); + } } ## ------------------------------------------------- @@ -809,8 +809,12 @@ This overrides the parent's method to add a few options. Specifically, it uses the Moose-specific constructor and destructor classes, and enables inlining the destructor. -Also, since Moose always inlines attributes, it sets the -C option to false. +Since Moose always inlines attributes, it sets the C option +to false. + +Because Moose attempts to inline C when possible, this method accepts +C and C options. The default is to inline the does +method, but an existing does method in a parent will not be replaced. =item B<< $metaclass->new_object(%params) >>