I have some scripts that I started with unit testing using the idea of โโ"modulino". I ran into a problem in that when the script is called with "perl -d" the script is not executed, since caller () returns the true value.
I have the main part of the script wrapped in main (), and some routines are slowly pulled from main () into their own routines.
At the top of the script, I have:
main(@ARGS) unless caller();
When called in .t tests, it works the way I want, and main () does not work, so I can test the routines. When I call a script from the CLI, it works fine with a call to main ().
The problem occurs when I call it from the CLI with:
perl -d myscript.pl
At this point, the caller returns a valid value (rather than undef), and main is not called.
Suggestions would be greatly appreciated on how to approach this.
debugging perl modulino
Lancew
source share