From dc31f1cd3841d486e920e59ce42e888ca94e4289 Mon Sep 17 00:00:00 2001 From: Gavin Carr Date: Wed, 21 Mar 2007 00:52:56 +0000 Subject: Finished initial --extra-opts support; added Getopt spec-to-help and multiline help support. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1643 f882894a-f735-0410-b71e-b25c423dba1c --- lib/Nagios/Plugin/Functions.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/Nagios/Plugin/Functions.pm') diff --git a/lib/Nagios/Plugin/Functions.pm b/lib/Nagios/Plugin/Functions.pm index 526dbed..751251f 100644 --- a/lib/Nagios/Plugin/Functions.pm +++ b/lib/Nagios/Plugin/Functions.pm @@ -46,6 +46,13 @@ our %STATUS_TEXT = reverse %ERRORS; my $_fake_exit = 0; sub _fake_exit { @_ ? $_fake_exit = shift : $_fake_exit }; +# Tweak default die handling: die is cool because it allows capturing both return codes and +# output via eval, but the Nagios Plugin Guidelines like STDOUT over STDERR +$SIG{__DIE__} = sub { + print STDOUT shift; + exit $!; +}; + sub get_shortname { my %arg = @_; @@ -390,7 +397,6 @@ This code is maintained by the Nagios Plugin Development Team: http://nagiosplug Copyright (C) 2006 by Nagios Plugin Development Team This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.4 or, -at your option, any later version of Perl 5 you may have available. +it under the same terms as Perl itself. =cut -- cgit v1.2.3-74-g34f1