Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to tell if an object inherits from a particular class?

0 views
Skip to first unread message

fishfry

unread,
Nov 5, 2009, 12:30:38 AM11/5/09
to
If I want to know if an object is of class Foo, I can call ref(object).

But if Foo inherits from Bar and I want to know if an object (of class
Foo) is of class Bar ... is there a convenient way to do that?

Peter Makholm

unread,
Nov 5, 2009, 1:45:04 AM11/5/09
to
fishfry <BLOCKSPA...@your-mailbox.com> writes:

> But if Foo inherits from Bar and I want to know if an object (of class
> Foo) is of class Bar ... is there a convenient way to do that?

$obj->isa('Bar')

Read 'perldoc perlobj' looke for the heading 'Default UNIVERSAL
metods' and read 'perldoc UNIVERSAL'

//Makholm

0 new messages