#!/usr/local/bin/perl -w # Doable.pm # my dbc OOPerl "interface" use strict; use warnings; use FindBin::libs; use Class::Contract; package Doable; { unless( eval { contract { # constant class attr 'NADA'; invar { ${self->NADA} = 0; }; abstract ctor 'new'; abstract dtor; # Control abstract method 'doTheThing'; # Test: DON'T implement doThatThing # and hope an exception is raised. abstract method 'doThatThing'; pre { defined ${Doable::caller} }; }; # end contract sub new; sub DESTROY; sub doTheThing; # sub doThatThing; 1; } # end eval ) { die( "\n\nThere has been a breach of contract.\n\n" ); } # end unless } 1; # end Doable