$old_metaclass->rebless_instance_away($instance, $self, %params)
if $old_metaclass;
+ if ($old_metaclass->is_anon_class) {
+ delete $instance->{__MOP__};
+ }
+
my $meta_instance = $self->get_meta_instance;
# rebless!
$meta_instance->rebless_instance_structure($_[1], $self);
$self->_fixup_attributes_after_rebless($instance, $old_metaclass, %params);
+
+ # NOTE:
+ # this will only work for a HASH instance type
+ if ($self->is_anon_class) {
+ (reftype($instance) eq 'HASH')
+ || confess "Currently only HASH based instances are supported with instance of anon-classes";
+ # NOTE:
+ # At some point we should make this official
+ # as a reserved slot name, but right now I am
+ # going to keep it here.
+ # my $RESERVED_MOP_SLOT = '__MOP__';
+ $instance->{'__MOP__'} = $self;
+ }
}
sub rebless_instance {