Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^3: my My $my;by shmem (Chancellor) |
on Oct 22, 2007 at 13:59 UTC ( [id://646441]=note: print w/replies, xml ) | Need Help?? |
Thanks for sharing that.
Toying around a bit, I found out that the RHS of my My $my = $foo need not be an object of class My, in fact, it can be any object, or even just a plain array reference:
Assigning the Foo object $foo to a lexical my My $bar makes it into a My object. Or it seems to do so; the object's body still is an array reference blessed into package Foo, while its fields seem to be of the My package. But then, the 'My' package didnn' import field 'foo'...? Scary stuff, that, great for obfus and to annoy your cow-orkers and maintainers, and for writing hard to spot bugs... --shmem
In Section
Seekers of Perl Wisdom
|
|