in reply to Re^2: How to Check whether the Function Parameter is a Scalar or a Hash
in thread How to Check whether the Function Parameter is a Scalar or a Hashref

If it's blessed, your checks will fail.

For some not very good definitions of fail...

Maybe I'm missing your point? The way I see it, if anyone actually needs to heed your warning either they are clever enough to work it out on their own or their design is questionable and should probably be fixed.

The documented behavior—ref returning the package a blessed ref has been blessed into—seems totally sane to me. If ref still returned "HASH" and you could find yourself in the position of unknowingly violating the documented interface for some thingy, I'd consider that a far worse failure condition; wouldn't you?

It's true that Perl gives you enough rope to hang yourself with... but shouldn't we warn people about looping that rope around their neck instead of just warning them about an arbitrary foot long section of the rope itself?

† For some reason, this reminds me of the warning on some blow dryers: "Do not use while showering or bathing."

-sauoq
"My two cents aren't worth a dime.";