in reply to Abstract class methods
in thread Interfaces in Perl?

The can will return true if the base class implements stub die subroutines, as the original poster proposed, however. Maybe what's needed is a direct defined check: something like:
die unless defined *{__PACKAGE__."::$_"}{CODE} for qw(foo bar);
I'm not sure but this might require softrefs enabled.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re (tilly) 2: Abstract class methods
by tilly (Archbishop) on Dec 01, 2000 at 04:34 UTC
    That is why I said that the technique fails if the base class implements stubs. It must list, not define, the methods.

    The direct defined check will work, but it means that every subclass must implement all of the methods. So if A is an abstract class, and B inherits from A and C inherits from B, then by default C has to define every one of the required methods.