in reply to Interfaces for the masses!

What about abstract classes? One can always prepare empty methods in a class that croak if they are not overwritten. The usage of SQL::Statement in DBI provides an example.

BTW Java Interfaces are mostly used to mimic multiple inheritance or as a marker ("this class can this or that").

Both usages are not needed in perl because it can be done directly.

Replies are listed 'Best First'.
Re^2: Interfaces for the masses!
by rvosa (Curate) on Mar 24, 2006 at 01:27 UTC
    That is how 'interfaces' are created in BioPerl. Bio::Tree::TreeI defines the methods any if its implementors must provide. It croaks if the methods are called directly on the interface.