salva has asked for the wisdom of the Perl Monks concerning the following question:
I have gotten a bug report containing a warning message which I am unable to explain.
The code is as follows:
The warning is: Use of uninitialized value in scalar assignment at /usr/lib/perl5/site_perl/5.14.2/Foo/Bar.pm line 123.sub _call_hook { my $name = shift; my $file = shift; # line 123 my $detach = shift; ...
_call_hook is being called as _call_hook($foo, $bar{$something}) where $bar{$something} does not exist.
Obviously, the warning is right, undef is being assigned to a scalar, but this is a pretty common case that doesn't generate a warning under normal conditions.
Could somebody shed some light on the subject? Which specific conditions may be triggering that warning?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Unexpected warning
by cdybedahl (Acolyte) on Nov 18, 2013 at 14:48 UTC | |
by LanX (Saint) on Nov 18, 2013 at 15:00 UTC | |
by salva (Canon) on Nov 18, 2013 at 15:08 UTC | |
by samwyse (Scribe) on Nov 18, 2013 at 16:14 UTC | |
by hdb (Monsignor) on Nov 18, 2013 at 15:07 UTC | |
by LanX (Saint) on Nov 18, 2013 at 15:15 UTC | |
by samwyse (Scribe) on Nov 18, 2013 at 17:11 UTC | |
by hdb (Monsignor) on Nov 18, 2013 at 15:01 UTC | |
Re: Unexpected warning
by MidLifeXis (Monsignor) on Nov 18, 2013 at 14:59 UTC |
Back to
Seekers of Perl Wisdom