}
sub rebless_instance_back {
- my ($self, $instance) = @_;
+ my ( $self, $instance ) = @_;
my $old_metaclass = Class::MOP::class_of($instance);
- my $old_class = $old_metaclass ? $old_metaclass->name : blessed($instance);
- $old_class->isa($self->name)
- || confess "You may rebless only into a superclass of ($old_class), of which (". $self->name .") isn't.";
+ my $old_class
+ = $old_metaclass ? $old_metaclass->name : blessed($instance);
+ $old_class->isa( $self->name )
+ || confess
+ "You may rebless only into a superclass of ($old_class), of which ("
+ . $self->name
+ . ") isn't.";
- $old_metaclass->rebless_instance_away($instance, $self)
+ $old_metaclass->rebless_instance_away( $instance, $self )
if $old_metaclass;
my $meta_instance = $self->get_meta_instance;
# we use $_[1] here because of t/306_rebless_overload.t regressions on 5.8.8
- $meta_instance->rebless_instance_structure($_[1], $self);
+ $meta_instance->rebless_instance_structure( $_[1], $self );
- for my $attr ($old_metaclass->get_all_attributes) {
- next if $self->has_attribute($attr->name);
- $meta_instance->deinitialize_slot($instance, $_)
- for $attr->slots;
+ for my $attr ( $old_metaclass->get_all_attributes ) {
+ next if $self->has_attribute( $attr->name );
+ $meta_instance->deinitialize_slot( $instance, $_ ) for $attr->slots;
}
return $instance;