|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Re: Modules as executable scripts?by friedo (Prior) |
| on Jun 15, 2007 at 02:14 UTC ( #621383=note: print w/ replies, xml ) | Need Help?? |
|
I typically do this:
Then I can execute the module itself as if it were a script. This is great for command-line tools that need to use inheritance or other OO-ish stuff. For a current project, I have my entire Test::Class-based test-suite implemented this way, so the test classes can be run as if they were .t files, but they inherit parent class tests. Update: Here is a node that discusses this technique in more detail: How a script becomes a module
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||