in reply to Testing by Contract
...Class::Contract is specifically tied to the concept of classes...
This is also mentioned in the Class::Contract POD under "Offering better facilities for retrofitting contracts".
Yep. This a cross-cutting concern that should not be tangled with a class definition framework. Such concerns are best untangled using the Aspect module. Of course it may be difficult to provide all the DBC features Class::Contract provides, like old() and inheritance support.
- See "A simple and practical approach to unit testing: The JML and JUnit way" for some work on going from assertions to tests, and a bibliography.