pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a function that I would like to respond to the same error conditions by both die()ing and exiting with specific exit codes. Is there a way to set the exit code with die?
Here's why I want this. I'm writing some nagios plugins. Nagios plugins are scripts that communicate broad status informaion with the script's exit code, and detailed status information with STDOUT. I'm writing several of these things and I'm trying to re-use my code by putting it into modules. Sometimes, I want to catch certain errors and other times I want the same errors to make the script die. If I use die(), I can't set the exit code, so I can't communicate the broad status info. If I use exit(), I can't catch the error.
Thanks!
-Pileofrogs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Die and Exit Codes
by rhesa (Vicar) on Nov 30, 2006 at 20:54 UTC | |
by pileofrogs (Priest) on Nov 30, 2006 at 21:44 UTC | |
|
Re: Die and Exit Codes
by ikegami (Patriarch) on Nov 30, 2006 at 20:27 UTC | |
|
Re: Die and Exit Codes
by jdporter (Paladin) on Nov 30, 2006 at 20:39 UTC |