"be consistent" | |
PerlMonks |
Re^5: A Scalar::Util::refaddr Oddityby hv (Prior) |
on Sep 27, 2005 at 16:23 UTC ( [id://495439]=note: print w/replies, xml ) | Need Help?? |
Your code introduces a bug not in the original, here:
You use the same regexp as the original, but because you are no longer blessing into a known package the regexp may match the package name instead of the address. Indeed, a bug common enough to warrant the introduction of a new fatal error in perl-5.8 would give rise to exactly that situation:
Admittedly it is harder to get an overloaded object inadvertently in the wrong class like this, but "0x" is not so unusual a sequence of characters that it is fair to assume it will never appear in a legitimate package name. In any case it is easy enough to fix, with either /.*0x(\w+)/ or /0x(\w+)\)\z/. Hugo
In Section
Seekers of Perl Wisdom
|
|