There's more than one way to do things | |
PerlMonks |
Want END block to run except when usage()/--help invocationby CoVAX (Beadle) |
on Feb 27, 2015 at 04:50 UTC ( [id://1118039]=perlquestion: print w/replies, xml ) | Need Help?? |
CoVAX has asked for the wisdom of the Perl Monks concerning the following question: This is the first time I've used an END block. I need its functionality because I call 'die' at several points throughout this program and I have to always perform the code in the END block. I was making the final edits to a program's usage() function and noticed the following warnings following a --help invocation: perl -w ks.pl -h
Ah so! (German for "I see!") -- these warnings were the result of the END block being (unconditionally) executed after the usage() function. While I understand why this is happening, my question is: is there a way to have an unconditional END block execute except when the program's usage() function is being invoked? If not, then I propose to create yet another function to be called prior to die()'ing that will execute what's presently in the END block. Here's the relevant code:
I thank you for your time and assistance.
Searched for donut and crumpit. Found donate and stumbit instead.
Back to
Seekers of Perl Wisdom
|
|