On Fri, 2005-11-04 at 21:49 +0100, Tels wrote:

> Not sure if a ref() check will suffice, but you could also always call:
> 
>       $object->can();
> 
> if it is not defined, it would use UNIVERSAL::can, otherwise the overriden 
> one. Or do I miss something?

There are two caveats.  First, if $object is a class name, it may
succeed.  Second, if it's not a valid invocant, you need to wrap the
whole expression in an eval block.

Scalar::Util works for several previous stable versions of Perl, as far
as I know, so I tend to use blessed() if I really need an object.

-- c

Reply via email to