7 package My::Attribute::Trait;
12 scalar reverse $self->name;
22 'My::Attribute::Trait' => {
24 reversed_name => 'eman',
33 package My::Other::Class;
38 'My::Attribute::Trait' => {
40 reversed_name => 'reversed',
42 -excludes => 'reversed_name',
49 my $attr = My::Class->meta->get_attribute('foo');
50 is($attr->eman, 'oof', 'the aliased method is in the attribute');
51 ok(!$attr->can('reversed'), "the method was not installed under the other class' alias");
53 my $other_attr = My::Other::Class->meta->get_attribute('foo');
54 is($other_attr->reversed, 'oof', 'the aliased method is in the attribute');
55 ok(!$other_attr->can('enam'), "the method was not installed under the other class' alias");
56 ok(!$other_attr->can('reversed_name'), "the method was not installed under the original name when that was excluded");