in reply to Do not use UNIVERSAL::isa this way; but why?

What do you think about using UNIVERSAL::isa on unblessed reference. Is it safe (recommendable)?

# checking whether argument is a subroutine reference if (!UNIVERSAL::isa($callback, 'CODE')){ } # popping last option parameter my $options_ref = @_ && UNIVERSAL::isa($_[-1], 'HASH')? pop(): {};

Replies are listed 'Best First'.
Re^2: Do not use UNIVERSAL::isa this way; but why?
by klekker (Pilgrim) on Dec 13, 2008 at 21:16 UTC
    If you are expecting a reference I would not recommend using UNIVERSAL::isa this way because the next one who has to deal with your code could believe that there is an object called 'HASH'. (Although this seems not to be very likely but I've seen worse things... :/ ).
    If you want to check a reference I would advise you to keep using ref().