return $new_name;
}
+sub apply_roles_to_object {
+ my ($me, $object, @roles) = @_;
+ my $new = $me->SUPER::apply_roles_to_object($object, @roles);
+ if ($INC{'Moo.pm'}
+ and my $m = Moo->_accessor_maker_for(ref $new)
+ and my $con_gen = Moo->_constructor_maker_for(ref $new)) {
+ require Sub::Quote;
+
+ my $specs = $con_gen->all_attribute_specs;
+ my %attrs = map { @{$INFO{$_}{attributes}||[]} } @roles;
+
+ my $assign = '';
+ my %captures;
+ foreach my $name ( keys %attrs ) {
+ my $spec = $specs->{$name};
+ if ($m->has_eager_default($name, $spec)) {
+ my ($has, $has_cap)
+ = $m->generate_simple_has('$_[0]', $name, $spec);
+ my ($code, $pop_cap)
+ = $m->generate_use_default('$_[0]', $name, $spec, $has);
+
+ $assign .= $code;
+ @captures{keys %$has_cap, keys %$pop_cap}
+ = (values %$has_cap, values %$pop_cap);
+ }
+ }
+ Sub::Quote::quote_sub($assign, \%captures)->($new);
+ }
+ return $new;
+}
+
sub _composable_package_for {
my ($self, $role) = @_;
my $composed_name = 'Role::Tiny::_COMPOSABLE::'.$role;