summaryrefslogtreecommitdiffstats
path: root/lib/Nagios/Plugin/Functions.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Nagios/Plugin/Functions.pm')
-rw-r--r--lib/Nagios/Plugin/Functions.pm10
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;
46my $_fake_exit = 0; 46my $_fake_exit = 0;
47sub _fake_exit { @_ ? $_fake_exit = shift : $_fake_exit }; 47sub _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
49sub get_shortname { 56sub 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
390Copyright (C) 2006 by Nagios Plugin Development Team 397Copyright (C) 2006 by Nagios Plugin Development Team
391 398
392This library is free software; you can redistribute it and/or modify 399This library is free software; you can redistribute it and/or modify
393it under the same terms as Perl itself, either Perl version 5.8.4 or, 400it under the same terms as Perl itself.
394at your option, any later version of Perl 5 you may have available.
395 401
396=cut 402=cut