in reply to (Debugging, Tracing, Trace, Instrumenting) Automatic tracing of my Perl code?
You may be able to take this on step further and place that in a package, say, 'FollowLines', and then do something like this:my $script; while (<DATA>) { $script .= $_; $script .= qq{print "line $.\\n";\n}; } eval $script; __END__ # your script goes here
Be advised, though, that multi-line constructs will break this. Consider this code:use FollowLines; __DATA__ # your script goes here
A print statement every line would be a Bad Thing. I'm afraid there's not much you can do to get this functionality in a reliable fashion.if ($some_var == 1 || $other_var == 2 || $third_var) { sprintf("%s %s %d %s\n", $some_var, $other_var, @rest); }
|
|---|