|laziness, impatience, and hubris|
Re: Needing help on testingby Discipulus (Abbot)
|on Oct 29, 2018 at 21:42 UTC||Need Help??|
Hello Zenzizenzizenzic and welcome to the monastery and to the wonderful world of Perl!
In my little experience, the short answer is: no, there is no an easy way to test code not contained in modules.
You can use IPC::Run3 to test your perl script, but you'll find soon that will be not an easy path. If your programs are interactive ones will be not easy at all.
My humble suggestion is to start familiarizing with tests testing your 20% of codebase that's already in modules, then identify which part of the codebase are critical and try to abstract their functionality in modules and write tests while coding your modules, not after.
You can also explore the Modulino (see it at mastering perl by brian d foy) tecnique that use caller You'll wrap all the code in a script into a main sub and you'll use main() if not caller(); see also this article at perlmaven.
Also some link on my bibliotheca can be worth to read.
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.