From: gfx Date: Fri, 2 Oct 2009 10:19:40 +0000 (+0900) Subject: Deprecate compute_all_applicable_attributes() and get_attribute_map() X-Git-Tag: 0.37_02~34 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3a6833503c4b132d636f048ceecba7ef4fbbc210;p=gitmo%2FMouse.git Deprecate compute_all_applicable_attributes() and get_attribute_map() --- diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index ecce4a3..cc3824d 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -131,16 +131,20 @@ sub add_attribute { return $attr; } -sub compute_all_applicable_attributes { shift->get_all_attributes(@_) } +sub compute_all_applicable_attributes { + Carp::cluck('compute_all_applicable_attributes() has been deprecated'); + return shift->get_all_attributes(@_) +} + sub get_all_attributes { my $self = shift; my (@attr, %seen); for my $class ($self->linearized_isa) { - my $meta = $self->_metaclass_cache($class) + my $meta = Mouse::Util::get_metaclass_by_name($class) or next; - for my $name (keys %{ $meta->get_attribute_map }) { + for my $name ($meta->get_attribute_list) { next if $seen{$name}++; push @attr, $meta->get_attribute($name); } diff --git a/lib/Mouse/Meta/Module.pm b/lib/Mouse/Meta/Module.pm index 282a1cf..30f7b8a 100755 --- a/lib/Mouse/Meta/Module.pm +++ b/lib/Mouse/Meta/Module.pm @@ -63,7 +63,11 @@ sub name { $_[0]->{package} } # add_attribute is an abstract method -sub get_attribute_map { $_[0]->{attributes} } +sub get_attribute_map { + Carp::cluck('get_attribute_map() has been deprecated'); + return $_[0]->{attributes}; +} + sub has_attribute { exists $_[0]->{attributes}->{$_[1]} } sub get_attribute { $_[0]->{attributes}->{$_[1]} } sub get_attribute_list{ keys %{$_[0]->{attributes}} }