Skip Menu |

This queue is for tickets about the Nagios-Plugin CPAN distribution.

Report information
The Basics
Id: 103190
Status: resolved
Priority: 0/
Queue: Nagios-Plugin

People
Owner: Nobody in particular
Requestors: TONYC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: defined %foo and defined @foo an error
Starting from perl 5.22 defined is no longer permitted on aggregates, ie. hashes and arrays. This has been warning as deprecated since at least 5.12, since it's behaviour is non-obvious. For an array or hash it doesn't check whether it has any elements, but whether some internal data structures have been initialized, for example: # perl 5.14.2 $ perl -M-warnings -le 'for (1 .. 2) { my %x; print 0+defined %x; print scalar keys %x; $x{abc} = 1 }' 0 0 1 0 The attached patch fixes the problem in Nagios-Plugin. Tony
Subject: nagios-plugin-defined.diff
diff -ru Nagios-Plugin-0.36-utQpug/t/Nagios-Plugin-Functions-01.t Nagios-Plugin-0.36-n_xrqn/t/Nagios-Plugin-Functions-01.t --- Nagios-Plugin-0.36-utQpug/t/Nagios-Plugin-Functions-01.t 2015-03-30 15:42:48.000000000 +1100 +++ Nagios-Plugin-0.36-n_xrqn/t/Nagios-Plugin-Functions-01.t 2010-12-03 22:46:21.000000000 +1100 @@ -19,7 +19,7 @@ is(get_shortname, "NAGIOS-PLUGIN-FUNCTIONS-01", "get_shortname ok"); # Hardcoded checks of constants -ok(%ERRORS, '%ERRORS defined'); +ok(defined %ERRORS, '%ERRORS defined'); is(OK, $ERRORS{OK}, "OK => $ERRORS{OK}"); is(WARNING, $ERRORS{WARNING}, "WARNING => $ERRORS{WARNING}"); is(CRITICAL, $ERRORS{CRITICAL}, "CRITICAL => $ERRORS{CRITICAL}"); Only in Nagios-Plugin-0.36-utQpug/t: Nagios-Plugin-Functions-01.t~
On Mon Mar 30 11:40:12 2015, NIERLEIN wrote: Show quoted text
> Thanks for your patch, its fixed with: > > https://github.com/monitoring-plugins/monitoring-plugin- > perl/commit/5b2ab7f928b17b2013bdc914e36f7c2314f7b922
Sorry, my patch was reversed, it looks like you'd already fixed the problem, so this should be reversed in your repository. Has the Nagios-Plugin distribution name been abandoned? Tony
oh, you are right. I seemed familiar, but i really should read patches more carefully. And yes, N::P is deprecated due to trademark problems.
This has been fixed in Monitoring-Plugin 0.39.