From: Jesse Luehrs Date: Sun, 21 Jun 2009 20:33:30 +0000 (-0500) Subject: push the __INSTANCE__ parameter back into cmop X-Git-Tag: 0.88~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e35aa5c1b0c95eb49761657dd50d0b04fadc1c69;p=gitmo%2FClass-MOP.git push the __INSTANCE__ parameter back into cmop --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 8efa7af..57be069 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -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); }