sub get_attribute_map { $_[0]->{attributes} }
sub has_attribute { exists $_[0]->{attributes}->{$_[1]} }
sub get_attribute { $_[0]->{attributes}->{$_[1]} }
+sub get_attribute_list {
+ my $self = shift;
+ keys %{$self->get_attribute_map};
+}
sub linearized_isa { @{ get_linear_isa($_[0]->name) } }
Returns a mapping of attribute names to their corresponding
L<Mouse::Meta::Attribute> objects.
+=head2 get_attribute_list -> { name => Mouse::Meta::Attribute }
+
+This returns a list of attribute names which are defined in the local
+class. If you want a list of all applicable attributes for a class,
+use the C<compute_all_applicable_attributes> method.
+
=head2 has_attribute Name -> Bool
Returns whether we have a L<Mouse::Meta::Attribute> with the given name.
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 15;
do {
package Class;
my $meta2 = Class->meta;
is($meta, $meta2, "same metaclass instance");
-can_ok($meta, 'name', 'get_attribute_map');
+can_ok($meta, 'name', 'get_attribute_map', 'get_attribute_list');
ok($meta->has_attribute('pawn'));
my $attr = $meta->get_attribute('pawn');
my $map = $meta->get_attribute_map;
is_deeply($map, { pawn => $attr }, "attribute map");
+my $list = [$meta->get_attribute_list];
+is_deeply($list, [ 'pawn' ], "attribute list");
+
ok(!$meta->has_attribute('nonexistent_attribute'));
eval "