Perl -d and modulino issue
<p>
I have some scripts that I have started unit-testing using the "modulino" idea. I have encountered a problem in that when the script is called with "perl -d" the script does not run as caller() returns a true value.
<p>
I have the main body of the script wrapped in a main() and some subroutines being slowly pulled out of the main() into their own subroutines.
<p>
At the top of the script I have:

    main(@ARGS) unless caller();


When called in .t tests it works as I want, not running main() so I can test the subroutines. When I call the script from CLI it works great calling main().
<p>
The problem occurs when I call it from the CLI with:

    perl -d myscript.pl


At this stage caller returns a valid value (rather than undef) and main is not called. :-(
<p>
Suggestions would be much appreciated about how to approach this one.
<p>
Thanks.


Perl -d and modulino issue
===

<p>
I have some scripts that I have started unit-testing using the "modulino" idea. I have encountered a problem in that when the script is called with "perl -d" the script does not run as caller() returns a true value.
<p>
I have the main body of the script wrapped in a main() and some subroutines being slowly pulled out of the main() into their own subroutines.
<p>
At the top of the script I have:

    main(@ARGS) unless caller();


When called in .t tests it works as I want, not running main() so I can test the subroutines. When I call the script from CLI it works great calling main().
<p>
The problem occurs when I call it from the CLI with:

    perl -d myscript.pl


At this stage caller returns a valid value (rather than undef) and main is not called. :-(
<p>
Suggestions would be much appreciated about how to approach this one.
<p>
Thanks.

