Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Bad line numbers .. bad!

by Jenda (Abbot)
on Jul 25, 2013 at 20:36 UTC ( #1046419=note: print w/ replies, xml ) Need Help??


in reply to Bad line numbers .. bad!

Any chance some of your lines end with CRLF and some just with LF? Check the file with a hexaeditor.

Jenda
Enoch was right!
Enjoy the last years of Rome.


Comment on Re: Bad line numbers .. bad!
Re^2: Bad line numbers .. bad!
by Eily (Curate) on Jul 25, 2013 at 21:05 UTC

    I tried that, it was actually lines that ended only with a carriage return that didn't increment the value of __LINE__.

    It's probably what causes phramus's problem I guess. If not, I only know of two other ways to have __LINE__ (which is replaced at compile time, so should not be affected by runtime operations) corresponding to something else than what seems obvious: source filtering and the #line directive:

    package Third; use Filter::Util::Call; $\ = $/; $, = ":"; print 4, __LINE__; ## Hello BEGIN { filter_add ( sub { $status = filter_read(); $_ = "" if /^##/; +return $status; } ); } print 7, __LINE__; ## World; print 9, __LINE__; #line 42 print 11, __LINE__;
    4:4
    7:7
    9:8
    11:42

    There the source filtering removes all lines starting with two #, but it has no effect on lines before the filter function is added, even though it's in a BEGIN block. So if the problem is source filtering, it has to be from a module included earlier (in the command used to run the script for example). And well, if phramus used #line 42 like comments in his script to keep track of the line number, that's tough luck.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1046419]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2015-07-05 13:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls