Sounds plausible.
How does that actually work though?
Googling that change led me to the old discussion, including some
TODO tests that cover the same problem as this bug:
http://www.nntp.perl.org/group/perl.perl5.porters/2008/04/msg136236.html
Tim.
I *think* (but don't quote me on that), that:
Line numbers in errors reports are calcuated by S_closest_cop() in util.c.
It treats STATEOPs and nullified STATEOPs equally, walking the compile-time
generated optree to do this.
However, something else (not sure what) must be reporting line numbers based
on PL_curcop, which is set at run time by pp_nextstate. That, of course, is
not invoked for nullified STATEOPs, just real STATEOPs.
So I infer that this is a bit of a hack to find a way of storing a line
number that one can see, and the other can not.
Nicholas Clark
Both warnings and errors go through Perl_vmess. The line number found
by closest_cop depends on the last cop executed (PL_curcop). That
should explain why the warning is not reported from the same point at
the first and subsequent iterations of the loop. The first time,
PL_curcop points at the ";" before the while; the next times, at the
";" after the last statement of the while (in a figured way). A
nullified stateop after the enterloop is likely to solve this.
This is still open (and affecting NYTProf).
Any chance it could be fixed for 5.12?
Tim.
At least for now, I've added this to the blocks-5.12 list
Any news on this one?
Tim.
To the best of my knowledge, "no". (I think that Jesse would be the best
person to answer this, but I believe that he's currently indisposed,
visiting relatives, and I'm not sure for how long.)
At various times the list has been pleasantly surprised by patches appearing
from various (thank-you) individuals to fix various open bugs, but no-one is
jumping up to volunteer to systematically work through and solve the bugs on
the list of blockers.
(I certainly don't have time)
For many of the bugs, it's a skilled job to diagnose and fix them.
A job.
Nicholas Clark
I can't really see that this is a 5.12 showstopper.
It's present in 5.8.x, and is just one of a whole class of bugs wherein
perl misreports line numbers. It really needs fixing as part of a general
post-5.12 overhaul of the line number reporting system, rather than
throwing another one-off hack at it.
--
I've often wanted to drown my troubles, but I can't get my wife to go
swimming.