QM has asked for the wisdom of the Perl Monks concerning the following question:
Currently, I do a manual find/replace in the editor of big chunks of code, equivalent to this:
s/;\s*$/; $DEBUG and printf STDERR "***LINE*** [%s] %s: %s (%d)\n", ti +me_stamp(), __FILE__, __PACKAGE__, __LINE__;/
This of course makes the code hard to read, and doesn't work everywhere (I think use and package might have problems with this, maybe others.) Colleagues often get distracted with these, instead of seeing the important bits.
Really I'd just like a source filter or module I can invoke on the command line to safely do this between statements, and not muddy up the source code.
Any suggestions?
Update: I use a special script to run the script on a remote cluster of hardware that is not available locally. All files needed are copied over and untarred into an appropriate temp dir, the script run, and all STDOUT and STDERR reported back to the originating terminal.
Interactive debug would be my first choice, but the nature of the system makes it much easier to do s/// and print lines into the output logs.
-QM
--
Quantum Mechanics: The dreams stuff is made of
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Module for Printing Line Numbers in Debug?
by clueless newbie (Curate) on Jan 21, 2013 at 12:48 UTC | |
|
Re: Module for Printing Line Numbers in Debug?
by LanX (Saint) on Jan 21, 2013 at 12:36 UTC | |
by QM (Parson) on Jan 21, 2013 at 13:23 UTC | |
by LanX (Saint) on Jan 21, 2013 at 13:35 UTC | |
by QM (Parson) on Jan 21, 2013 at 14:19 UTC | |
by LanX (Saint) on Jan 21, 2013 at 14:45 UTC |