Exploding check commands batman ...
Paul L. Allen
pla at softflare.com
Fri Jul 1 22:57:20 CEST 2005
Darren Dunham writes:
>> In strict mode uninitialized variables cannot be used in comparisons.
>> So if somebody does manage to do something that results in a variable
>> holding an option being uninitialized, as opposed to being initialized
>> with the null string, things break. Outside of strict mode an
>> uninitialized variable is false in a boolean context, 0 in a numeric
>> context and the null string in a string context; in strict mode all you
>> can do with an unitialized variable without causing an error is assign
>> to it.
>
> Perl's strict deals with "compile time" issues like lexical scoping
> (declaration rather than initialization). It doesn't do anything with
> run time issues like undefined variables. That would be noticed by
> warnings, not strict.
Ooops, you're right. My error. I did tests with both to simulate
a typical plugin. I don't use either strict or -w often enough for
which is responsible for which headaches to make it reliably into my
memory (most of the perl I write is one-off, fix up this immediate
problem, won't be run by anybody but me).
> It certainly doesn't preclude comparisons with the undefined value or
> uninitialized variables. In no case is it an error.
Add -w and it is a warning - enough usually to mess up your day with a
plugin because the variable being undefined when it shouldn't have been
usually causes it to bomb out with an error.
Thanks for the correction.
--
Paul Allen
Softflare Support
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list