From: Dave Rolsky Date: Tue, 17 Mar 2009 16:04:56 +0000 (-0500) Subject: The CMOP::Method::Constructor->attributes method is used only once, X-Git-Tag: 0.80_01~30 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6e2f5a81a415939e6490f667c665b930f57432fa;p=gitmo%2FClass-MOP.git The CMOP::Method::Constructor->attributes method is used only once, and can be replaced by directly getting the attributes from the metaclass. Deprecating the attributes method. --- diff --git a/lib/Class/MOP/Method/Constructor.pm b/lib/Class/MOP/Method/Constructor.pm index 3c4c637..fdb2a30 100644 --- a/lib/Class/MOP/Method/Constructor.pm +++ b/lib/Class/MOP/Method/Constructor.pm @@ -67,6 +67,9 @@ sub meta_instance { } sub attributes { + warn 'The attributes method is deprecated.' + . " Use ->associated_metaclass->compute_all_applicable_attributes instead.\n"; + my $self = shift; $self->{'attributes'} ||= [ $self->associated_metaclass->compute_all_applicable_attributes ] } @@ -120,7 +123,7 @@ sub _generate_constructor_method_inline { $source .= "\n" . 'my $instance = ' . $self->meta_instance->inline_create_instance('$class'); $source .= ";\n" . (join ";\n" => map { $self->_generate_slot_initializer($_, $close_over) - } @{$self->attributes}); + } $self->associated_metaclass->compute_all_applicable_attributes); $source .= ";\n" . 'return $instance'; $source .= ";\n" . '}'; warn $source if $self->options->{debug};