[Catalyst] Re: [OT] Universal::CAN warning from TT?

A. Pagaltzis pagaltzis at gmx.de
Wed Nov 22 18:20:08 GMT 2006


* Jonathan Rockway <jon at jrock.us> [2006-11-22 17:50]:
> You would never call a class method directly like that (because
> it won't work), so you shouldn't do that with UNIVERSAL::can or
> UNIVERSAL::isa.

For completeness’ sake, there is exactly one acceptable use of
`UNIVERSAL::can` as a function:

    !!UNIVERSAL::can( $foo, 'can' )

This is a cheap and highly backward compatible replacement for
`Scalar::Util::blessed`.

There may be some esoteric cases where the result of that
expression will be incorrect, but they’re even more bizarre than
the concept of quantum superposition and can probably never
happen without XS mischief.

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hacker;
#Aristotle



More information about the Catalyst mailing list