|more useful options|
Re: Possible to have a module act as a standalone??by BrowserUk (Pope)
|on Mar 18, 2003 at 22:49 UTC||Need Help??|
I think that including a test script into the same file as a module (and its pod) is a good idea (I said as much in RFC: Runnable test code integrated into Modules.), and now do this regularly in my own modules. If that test code happened to be useful standalone, then it is serving two possible uses which seems like a good thing to me.
A short example of doing this is a module I originally wrote to see if I could profile regexes Re: Profiling regular expressions. It now looks like this.
It can be run standalone like this
Or used from a script like this.
The only downside is having to switch to the directory where the module lives or specify the full path to in order to invoke it standalone, but there are several ways around that.
Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.