From: Dave Rolsky Date: Wed, 27 Oct 2010 05:21:56 +0000 (-0500) Subject: Make sure to handle the case where a CMOP::Attribute is passed to clone_and_inherit_o... X-Git-Tag: 1.18~41 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d412262b5262860b0a0baa2cca0b52cb28f27980;p=gitmo%2FMoose.git Make sure to handle the case where a CMOP::Attribute is passed to clone_and_inherit_options --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 5d3f5d5..e40c571 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -213,7 +213,10 @@ sub clone_and_inherit_options { $options{traits} = \@all_traits if @all_traits; } - $self->_modify_attr_options_for_lazy_build( $self->name, \%options ); + # This method can be called on a CMOP::Attribute object, so we need to + # make sure that $self actually has this method. + $self->_modify_attr_options_for_lazy_build( $self->name, \%options ) + if $self->can('_modify_attr_options_for_lazy_build'); $self->clone(%options); }