in reply to Re^2: Why reftype and blessed are making my life harder than it needs to be
in thread Why reftype and blessed are making my life harder than it needs to be

Reading the code for it, it looks like it can't return q{}. If ref returns the empty string, reftype returns undef. Otherwise, it looks like it gives one of the underlying types. Looks like blessing into the empty string will still slip past reftype. (Bug or feature? You make the call...)

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Replies are listed 'Best First'.
Re^4: Why reftype and blessed are making my life harder than it needs to be
by dragonchild (Archbishop) on Feb 10, 2006 at 13:38 UTC
    So, should there be a patch to reftype() so that it returns one(qw{HASH ARRAY SCALAR CODE GLOB IO REF}) or the empty string?

    Why is reftype() even checking ref() in the first place ... reftype() is supposed to return the underlying representation, not the classname. I thought that's what blessed() is for.


    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?