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

Perrin Harkins perrin at elem.com
Wed Nov 22 19:26:06 GMT 2006


A. Pagaltzis wrote:
> 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`.

It was done this was in Template Toolkit because UNIVERSAL::isa is 
unreliable, as noted in the comments.  I'm not sure if 
Scalar::Util::blessed has the same problem or not, but I've definitely 
seen the issue that Andy was trying to work around with UNIVERSAL::isa.

- Perrin



More information about the Catalyst mailing list