# script.pl sub foo { ...; $retval; } sub bar { ...; $retval; } sub main { foo() or die(); bar() or die(); } # Call main only if no stack. Non-empty stack means we're testing. # See chapter 9 of Perl Testing - A Developer's Notebook main() unless caller;