in reply to Separation of interface and implementation

In perl, there isn't an "interface" keyword.

The "interface" keyword in Java provides a way for the compiler to check that a certain class implements the set of methods that make up this interface. The Perl compiler does not do this for you, so you cannot declare an "interface" to the compiler. You can, however, declare it to the programmer, for example in a POD.

A good example of many independent implementations of such an interface are the low-calorie drop-in replacements for CGI.pm, or Apache::Request which emulates CGI.pm for use under mod_perl. Note that none of these implementations provides the whole interface of CGI.pm (they are, in fact, making a point of not doing so), that the Perl compiler cannot warn you about this, and that things work anyway (if you read their POD).

  • Comment on Re: Separation of interface and implementation