sub tst {
my ($x) = @_;
if ( $x->isa('Foo') ) {
say "Same type";
}
elsif ( $x->isa('FooExt') ) {
my $issubclass = grep { $_ eq 'Foo' } @FooExt::isa;
say $issubclass ? "Extends type" : "Same type";
}
else {
say "Not related"
}
}
To determine whether a FooExt object inherits from class Foo, we look for Foo in the @isa list. See demo for class definitions.