I'm new to unit testing in Perl, so this may be a stupid question. Using Test::More to test .pm perl modules is quite simple as you just "use" the module in your test executable and call the module's subroutines inside your tests.
However, I was wondering if there is a standard, safe way of testing simple .pl scripts? I can just "use" or "eval" the file at the top of the test script and call the subroutines, but this isn't safe if the .pl file actually executes when called with no parameters. There is a module Sub::Import that can import the subroutines in the .pl file without executing the code, but this doesn't import the modules the .pl file uses, so it only works for scripts that are completely self contained and don't use external modules. Is there a clean workaround for this, or is it general practice to put all code into modules? Thanks for any help.