Dave Disser 
 searching the @ISA tree
 searching the @ISA tree
 08 May 1996 11:09:55 -0700
 Hewlett Packard, San Diego Division
-  Newsgroups:
-  comp.lang.perl.misc
Is there any sort of builtin way to tell if an object is a subclass of
another?  I can check it with this code, but I want to use a
'standard' way if it's there.
sub isa {
    my($self, $class, $seen) = @_;
    return 1 if (ref $self or $self) eq $class;
    for (@{(ref $self or $self) . '::ISA'}) {
	next if ++$seen->{$_} > 1;
	return 1 if $_ eq $class or &isa($_, $class, $seen);
    }
    return 0;
}
@FOO::ISA = (BAR);
@BAR::ISA = (BAZ);
$x = {};
bless $x, FOO;
print &isa($x, FOO), " FOO\n";
print &isa($x, BAR), " BAR\n";
print &isa($x, BAZ), " BAZ\n";
print &isa($x, BUZ), " BUZ\n";
yields:
1 FOO
1 BAR
1 BAZ
0 BUZ
-- 
Dave Disser