When programming it's always a good idea to check return status to make that no error has occured. In Perl we often write
somethingWeWantToDo or die "we failed because .....";
However when running in a test environment we may not have all our infrastructure in place to make our operation pass when needed (ideally we should use mock objects or some other testing framework). A hack is to pass a flag into the program telling it that we are running in a test jig and we don't care if our operation fails. The solution is simple, but a pain to work out after lunch...
somethingWeWantToDo or $testJig or die "we failed because .....";
If we fail and we are not using our test jig then we will exit with the appropriate diagnostics. i.e. failure is optional in a test jig
This is much easier than cluttering the code with conditonal if statements.