in reply to Dual personality: Module and script
I do this all the time. Nearly all my modules have the skeleton:
#! perl -slw package MyPackage; ... return 1 if caller; package main; use Devel::StealthDebug; our $ITERS ||= 10; our $OTHER ||= 'default'; ## run test code here
That allows me to embed the unit test code for the module directly into the module itself, keeping it all together.
The testcode then also serves as sample code for users (should any of my half-baked ideas ever get refined enough that I feel able to let it loose on the world :).
|
|---|