Hello Monks,
I want to temporarily re-bless an instance into a specialised child-class for the scope of a block. Is there any way to do this automatically? or do I have to bless and reverse bless as in this eg?
# is there any way to limit the scope of bless? sub doit { my $db = shift; die "not a database class: $db" unless $db->isa("Database"); my $original = ref($db); bless $db, "Database::Special"; $db->doSomethingSpecial(); bless $db, $original; return $db->doNormalStuff(); }
Regards & thanks,
Jeff
In reply to limiting the scope of bless by jaa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |