in reply to Re: Re: Is there any way of determining the current line number of a child process while it is running?
in thread Is there any way of determining the current line number of a child process while it is running?
I can see how adding print __LINE__ to the end of each line of your scripts would be a time consuming, boring and repetative task... Hang on, that sounds like an ideal application for a computer:)
Install Filter::Simple, put a copy of the following snippet into .../site/lib/Filter/LineTrace.pm
package Filter::LineTrace; use Filter::Simple; FILTER_ONLY code => sub { s[;\s*$][;print STDERR __LINE__;]mg; }, ; # Replace the next line with 1; print STDERR 'Filter::LineTrace loaded';
And add use Filter::LineTrace; to the top of your scripts and each line that ends in a /;\s*\n/ will now print its line number to STDERR.
As-is, the line numbers don't always match the lines exactly, but they are only usually out by 1 if at all, and not every line ends in a semicolon, so they don't all get traced, but it may be enough for your purpose.
If not, you could add addition substitutions to catch those that end in { or } etc. as required.
|
|---|