exec('true');You'd put that in place of any
exit()statement as well. I'll leave it to you to figure out return values. It's not that hard.
So, why did I need this?
I have this large program in perl, and it has a module that prints out a bunch of stats in the END block. This is all fine for the default use case, but today I needed to write another small program that does a bunch of auditing on this module - something like a unit test, but not exactly.
Anyway, this smaller program only needed the module to initialise, but not actually execute, and it doesn't require the stats at the end of the code to be printed either, so I needed to figure out how to run a program without executing the END block.
I looked up the
perlmoddoc, and it said that the only conditions under which END is not executed is if the process is replaced using
execor you're thrown out of the water by a signal. Voilà, no more END.