27 has ca => (is => 'rw');
31 has cb => (is => 'rw');
35 has cc => (is => 'rw');
38 my $obj = Child->new(class => 1, child => 1);
39 ok($obj->child, "local attribute set in constructor");
40 ok($obj->class, "inherited attribute set in constructor");
42 is_deeply([sort(Child->meta->get_all_attributes)], [sort(
43 Child->meta->get_attribute('child'),
44 Class->meta->get_attribute('class'),
45 )], "correct get_all_attributes");
47 is_deeply([sort(CC->meta->get_all_attributes)], [sort(
48 CC->meta->get_attribute('cc'),
49 CB->meta->get_attribute('cb'),
50 CA->meta->get_attribute('ca'),
51 Class->meta->get_attribute('class'),
52 )], "correct get_all_attributes");
53 } 'Class', 'CA', 'CB', 'CC';
75 is($foo->attr, 'Foo', 'subclass does not affect parent attr');
78 is($bar->attr, undef, 'new attribute does not have the new default');
80 is(Foo->meta->get_attribute('attr')->default, 'Foo');
81 is(Foo->meta->get_attribute('attr')->_is_metadata, 'ro');
83 is(Bar->meta->get_attribute('attr')->default, undef);
84 is(Bar->meta->get_attribute('attr')->_is_metadata, 'rw');
86 is_deeply([Foo->meta->get_all_attributes], [
87 Foo->meta->get_attribute('attr'),
88 ], "correct get_all_attributes");
90 is_deeply([Bar->meta->get_all_attributes], [
91 Bar->meta->get_attribute('attr'),
92 ], "correct get_all_attributes");