![]() |
|
Syntactic Confectionery Delight | |
PerlMonks |
Re: Object Suicideby ChemBoy (Priest) |
on Jun 15, 2007 at 20:00 UTC ( [id://621511]=note: print w/replies, xml ) | Need Help?? |
What you're trying to do here is definitely possible, though I'm not sure it's advisable. The key is that you can't use the standard my $self = shift; boilerplate in that method, because that makes a copy of the caller's reference, rather than operating on it directly (this is usually a good thing). Rather, it would need to look something like the below:
Note that this will only destroy the reference in the immediate calling code—if you call this from another method that uses the my $self = shift; trick, it will not propagate the change to whoever called that method. And again, <symbolic hand-washing>I'm not advising you to do this, but it's there if you want it</symbolic hand-washing>. :-) If God had meant us to fly, he would *never* have given us the railroads. --Michael Flanders
In Section
Seekers of Perl Wisdom
|
|