9 has 'attr1' => (is => 'ro', required => 1);
17 has 'attr2' => (is => 'ro', required => 1);
19 __PACKAGE__->meta->make_immutable;
27 has 'attr3' => (is => 'ro', required => 1);
35 has 'attr4' => (is => 'ro', required => 1);
37 __PACKAGE__->meta->make_immutable;
40 foreach my $num (1..4) {
41 my $class = "Tower${num}";
42 my @attrs = map "attr$_", 1..$num;
43 my %args = map +($_ => "${_}_value"), @attrs;
44 my $obj = $class->new(%args);
45 is($obj->{$_}, "${_}_value", "Attribute $_ ok for $class") for @attrs;