whitespace/style cleanups
[gitmo/Moo.git] / lib / Moo / HandleMoose.pm
index 1918522..ec745cf 100644 (file)
@@ -50,7 +50,6 @@ sub inject_fake_metaclass_for {
 
   sub _uninlined_body { \&Moose::Object::new }
 }
-    
 
 sub inject_real_metaclass_for {
   my ($name) = @_;
@@ -179,7 +178,8 @@ sub inject_real_metaclass_for {
     $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) {
@@ -191,6 +191,10 @@ sub inject_real_metaclass_for {
       $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