I saw this on MJD's QOTW. See QOTW #14 Solution and the TestDupl.pm module. Maybe you can expound on this idea for your needs.
in reply to Testing Non-module code
Create a module (say YourTestModule), and in the INIT block calls a module sub that runs your tests, then exits (never actually running your program in full).
I'd be interested in comments as to the usefulness of this approach for "serious" code. (Or perhaps there's a better way that hasn't been mentioned yet?)
Run your tests by:
perl -MYourTestModule yourprogram
Quantum Mechanics: The dreams stuff is made of