New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if ... elsif gives wrong line # for warning about undefined value #8133
Comments
From @nwc10I believe that the "wrong" line given by the warning inside an if elsif else nick@Bagpuss [PerlIO-gzip-0.09]$ perl Makefile.PL from this line (46) } elsif ( where line 29 is the start of the first if(). If the used once warning can get the line correct, why can't the undefined [obviously my bug is that "config" should be "Config", but that doesn't Nicholas Clark Perl Info
|
From @pjcj
I think you'll find that that it is for the same reason.
The undefined warning isn't given until the code is executed, by which You can confirm this by doing something like perl -MO=Deparse,-l Makefile.PL or perl -MO=Concise Makefile.PL if you really want the gory details. |
From wolfgang.laun@alcatel.at#! /usr/bin/perl -w produces the diagnostic Bareword "foo" not allowed while "strict subs" in use at ./bug.pl line 4. The line number shown (4) is the one of the if statement, but, The line no is correct if there is a syntax error, so this is probably Perl Info
|
From @floatingatollNow, I can speculate a bit from here. -- begin speculation perly.y, line 207. It's getting the line number, but the line number is Solution? Get the line number up to date right here at this line, so Maybe that's not possible, for some reason. Okay. How about the line -- end speculation Of course, I don't even know where to start with the speculations, but R.
|
From @jlokierCreated by @jlokierThis small program illustrates the bug: if (0) { The output is: Can't use an undefined value as a SCALAR reference at - line 1. It _should_ say line 2, not line 1. This is pretty confusing if you Compile time errors are fine. For this program: if (0) { the output is: Can't modify constant item in scalar assignment at - line 2, near "2) " Enjoy, Perl Info
|
From @rgsJamie Lokier (via RT) wrote:
There is a whole class of problems like this that are due to the way
|
The RT System itself - Status changed from 'new' to 'open' |
From ludemann@yahoo-inc.comCreated by ludemann@yahoo-inc.comMy problem code had something like this: if (defined $a && $a =~ m/.../) { # line 1 <== got warning about this This was getting an occasional, clearly bogus, warning about an (BTW, the message "Use of uninitialized value in pattern match Perl Info
|
From @ysthOn Wed, Sep 28, 2005 at 01:46:02PM -0700, ludemann @ yahoo-inc. com wrote:
This is because the undefined value is tripped over in a statement
Can anyone suggest something other than "pattern match (m//)" that |
The RT System itself - Status changed from 'new' to 'open' |
From sts@accognoscere.orgOn Wed, Sep 28, 2005 at 01:46:02PM -0700, ludemann@yahoo-inc.com (via RT) wrote:
That's most likely due to the way the optimizer works; that's not only
"Use of uninitialized value in pattern match (m//)" is definitely referring Excerpt from 'perldoc perldiag': Use of uninitialized value%s (W uninitialized) An undefined value was used as if it were already To help you figure out what was undefined, perl tells you what operation Steven |
From @pjcjOn Wed, Sep 28, 2005 at 01:46:02PM -0700, ludemann@yahoo-inc.com wrote:
The problem here is that there is no information in the optree $ perl5.9.3 -MO=Concise -we 'if ($a) {}
I won't disagree there, but rightly or wrongly (OK, wrongly) people parse error However, were the problem with an uninitialised value in the pattern Of course, if you are still running 5.6.1 then it might be a while -- |
From sts@accognoscere.orgOn Thu, Sep 29, 2005 at 03:09:14AM -0700, Yitzchak Scott-Thoennes wrote:
"Use of uninitialized value in variable being pattern matched"? Although, that could be misunderstood too. But I guess, it's at least Other ideas? |
From david@landgren.netSteven Schubiger wrote:
"applying a pattern to match undefined value at line n" The issue at hand, however, is that the OP is interested in David |
From @rgsPaul Johnson wrote:
Without adding the equivalent of cop_line and cop_file to OP_SCOPE, -- |
From @iabynOn Fri, Sep 30, 2005 at 01:48:20PM +0200, David Landgren wrote:
Unless we put in some special-case code, the warning is always going to "Use of uninitialized value" . <optional variable name> . " in " -- |
From @smpeters
Hmmm...the past repeats itself... #6837 - line number dichotomy on warnings Well, I can at least merge all these old tickets in with this one. |
From @rgsThis bug has been fixed by change #33710. |
@rgs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#37302 (status was 'resolved')
Searchable as RT37302$
The text was updated successfully, but these errors were encountered: