good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
A Scalar::Util::refaddr Oddityby Zaxo (Archbishop) |
on Sep 25, 2005 at 15:40 UTC ( [id://494914]=perlquestion: print w/replies, xml ) | Need Help?? |
Zaxo has asked for the wisdom of the Perl Monks concerning the following question: During a hot cb discussion of Scalar::Util::refaddr, I noticed that the pure perl version of the function will alter an unblessed reference passed to it. The sub goes as follows: The reblessing to a fake namespace is to eliminate problems from overloading in the target's class, the issue that first made me look at the source. The oddity is that an unblessed reference will wind up blessed if it is the argument of refaddr. Here's a demo: The normally-loaded XS version of the function does not exhibit that behavior. Pure perl refaddr can be fixed to act like the XS version by making the bless lines conditional on a stored value of Scalar::Util::blessed($_[0]). My question: Is it worth fixing? Are there any odd side effects of that blessing? Are any significant properties changed? After Compline,
Back to
Seekers of Perl Wisdom
|
|