On Thu, Aug 28, 2014 at 12:43:48PM +0100, David Cantrell wrote:
> On Wed, Aug 27, 2014 at 08:54:07AM -0700, Karen Etheridge wrote:
> 
> > ..but as others have said, you don't 'use UNIVERSAL' directly - in fact the
> > word 'UNIVERSAL' should never have to appear in your code.
> 
> It might never *have to* appear in your code, but it is on occasion
> rather handy. UNIVERSAL::isa is useful for non-objecty code that
> manipulates or inspects classes, for example.

You should never run UNIVERSAL::isa as a function - only run it as a
method, using the class or object as the invocation subject.  The function
form was removed from documentation *long* ago for very good reason.
Calling it this way breaks any code that overrides isa().
That's why I said the *word* UNIVERSAL should never appear, not the use of
the interfaces it provides.

good:
    $class->isa('thing')
    $object->isa('thing')
    ClassName->isa('thing')

bad:
    UNIVERSAL::isa('ClassName', 'thing')

Reply via email to