[Israel.pm] FW: newbie question
xsawyerx at gmail.com
Thu Jan 15 07:02:14 PST 2009
> By the way, my scripts are one exception when you must not use the strict /
> warning modules.
> Since it's coded for working with nagios engine, and needed some variables
> to be used in some stages where
> The same variables couldn't be defined.
I also code for Nagios, and you should use strict and warnings always.
Lets say that people who "allow" themselves to not use strict, are
those who use strict all the time and once in a while want to do some
magic with strict 'ref'.
Anyway, Nagios team themselves suggest on using strict. Also, you can
use the EPN there. There's a lot of documentation for it, and Nagios
plugins that help writing plugins for Nagios which also pass strict
(for a good reason).
That's about using strict (and warnings) on Nagios.
> I tried coding first with strict, but it showed too many warnings, which
> couldn't be avoided.
It means you've made too much mistakes or common errors. You should
check them out and clear them to make sure your module/script would be
in perfect condition and won't have any unexpected behavior.
> I know the if () statement compares the values to 0, same as in C, C++
> But I wonder if defined does something with the arguments sent to it - like
> check allocation to memory or so.
No. defined only checks whether it's defined.
As specified by others, use a backslash in front of the variable to
get the memory address for it. As far as I know, the memory indication
is correct and used correctly because some modules actually check
circular memory allocation to detect leaks and possible infinite
> Also I know @arr returned a ARRAY(address) - so why can I check it using
> if() maybe because it returns the addres value.
> So, does my @arr; return 0 ?
> Also, can I compare @arr1 = @arr2 and check if they are allocated to same
> place? Like addresses in C
What is it you're trying to accomplish exactly?
More information about the Perl