I want to temporarily make an object a member of a second (third, fourth) class, overriding some methods, but retaining all attributes when the object reverts. I'm worried that the solution above might have unwanted side-effects.package Liftable; use Class:ISA; sub new { bless $_[1], $_[0] } sub lift { my $self = shift; my $old_class = ( grep { $_ !~ /__PACKAGE__/ } ( Class::ISA::super_path( ref($self) ) ) )[0]; bless $self, $old_class; }
In reply to messing with @ISA - unblessing by Boldra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |