require Method::Generate::Accessor;
Method::Generate::Accessor->new
});
+ my $con_gen = $Moo::MAKERS{$target}{constructor};
my @attrs = @{$INFO{$role}{attributes}||[]};
while (my ($name, $spec) = splice @attrs, 0, 2) {
+ # needed to ensure we got an index for an arrayref based generator
+ if ($con_gen) {
+ $spec = $con_gen->all_attribute_specs->{$name};
+ }
$acc_gen->generate_method($target, $name, $spec);
}
}
is_deeply([ @$o ], [ 1, 2, 3, 4 ], 'Subclass object ok');
+{
+ package ArrayTestRole;
+
+ use Moo::Role;
+
+ has four => (is => 'ro');
+
+ package ArrayTest3;
+
+ use Moo;
+
+ extends 'ArrayTest1';
+
+ with 'ArrayTestRole';
+}
+
+$o = ArrayTest3->new(one => 1, two => 2, three => 3, four => 4);
+
+is_deeply([ @$o ], [ 1, 2, 3, 4 ], 'Subclass object w/role');
+
done_testing;