in reply to Re^2: Writing my first module
in thread Writing my first module
There is one trick that I sometimes use....
It is possible for your module to know if it was "used" versus executed directly. This allows me to put a test driver in the module itself that I use during development that presents more info that just a "pass/fail". If you do this, you will want your .pm to be an executable file under Unix.
#Normal module preamble here... sub test{ print "this is a dev test...\n"; } test() if not caller; ### Run test() if run directly #Normal rest of module code here.... 1;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Writing my first module
by harangzsolt33 (Deacon) on Aug 30, 2023 at 14:34 UTC |