diff options
Diffstat (limited to 'lib/Nagios/Plugin/Functions.pm')
-rw-r--r-- | lib/Nagios/Plugin/Functions.pm | 10 |
1 files changed, 8 insertions, 2 deletions
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; | |||
46 | my $_fake_exit = 0; | 46 | my $_fake_exit = 0; |
47 | sub _fake_exit { @_ ? $_fake_exit = shift : $_fake_exit }; | 47 | sub _fake_exit { @_ ? $_fake_exit = shift : $_fake_exit }; |
48 | 48 | ||
49 | # Tweak default die handling: die is cool because it allows capturing both return codes and | ||
50 | # output via eval, but the Nagios Plugin Guidelines like STDOUT over STDERR | ||
51 | $SIG{__DIE__} = sub { | ||
52 | print STDOUT shift; | ||
53 | exit $!; | ||
54 | }; | ||
55 | |||
49 | sub get_shortname { | 56 | sub get_shortname { |
50 | my %arg = @_; | 57 | my %arg = @_; |
51 | 58 | ||
@@ -390,7 +397,6 @@ This code is maintained by the Nagios Plugin Development Team: http://nagiosplug | |||
390 | Copyright (C) 2006 by Nagios Plugin Development Team | 397 | Copyright (C) 2006 by Nagios Plugin Development Team |
391 | 398 | ||
392 | This library is free software; you can redistribute it and/or modify | 399 | This library is free software; you can redistribute it and/or modify |
393 | it under the same terms as Perl itself, either Perl version 5.8.4 or, | 400 | it under the same terms as Perl itself. |
394 | at your option, any later version of Perl 5 you may have available. | ||
395 | 401 | ||
396 | =cut | 402 | =cut |