good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It can't ever work, because of the problem of references.
Storable supports circular references correctly, and the implementation of this means that what is in $_[0] may already have 4 or 5 other Perl references pointing to it by the time the hook gets called. So if you were to replace $_[0] with $singleton, you would break all the other references. If Perl references were purely heirachal, this wouldn't be a problem. And that is why we have a seperate method. Because it provides an alternative that certifies that that class won't end up creating circular references below it, and thus that a modify/return type result will work sanely. Read through bug #4901 and you might be able to understand it a bit more. It took me a long time. In reply to Re^4: Safely altering the behaviour of heavily used modules
by adamk
|
|