sub _uninlined_body { \&Moose::Object::new }
}
-
sub inject_real_metaclass_for {
my ($name) = @_;
$meta->add_required_methods(@{$info->{requires}});
foreach my $modifier (@{$info->{modifiers}}) {
my ($type, @args) = @$modifier;
- $meta->${\"add_${type}_method_modifier"}(@args);
+ my $code = pop @args;
+ $meta->${\"add_${type}_method_modifier"}($_, $code) for @args;
}
} else {
foreach my $attr (@attrs) {
$meta->find_method_by_name('new'),
'Moo::HandleMoose::FakeConstructor',
);
+ # a combination of Moo and Moose may bypass a Moo constructor but still
+ # use a Moo DEMOLISHALL. We need to make sure this is loaded before
+ # global destruction.
+ require Method::Generate::DemolishAll;
}
$meta->add_role(Class::MOP::class_of($_))
for grep !/\|/ && $_ ne $name, # reject Foo|Bar and same-role-as-self