push the __INSTANCE__ parameter back into cmop
[gitmo/Class-MOP.git] / lib / Class / MOP / Class.pm
index 8efa7af..57be069 100644 (file)
@@ -371,7 +371,11 @@ sub _construct_instance {
     my $class = shift;
     my $params = @_ == 1 ? $_[0] : {@_};
     my $meta_instance = $class->get_meta_instance();
-    my $instance = $meta_instance->create_instance();
+    # FIXME:
+    # the code below is almost certainly incorrect
+    # but this is foreign inheritance, so we might
+    # have to kludge it in the end.
+    my $instance = $params->{__INSTANCE__} || $meta_instance->create_instance();
     foreach my $attr ($class->get_all_attributes()) {
         $attr->initialize_instance_slot($meta_instance, $instance, $params);
     }