You could achieve this with the Perl debugger. The trick is to get an interactive debugger session into your CGI script as you interact with it through a web page. I do this with Catalyst apps and it fires of a terminal on my system when the code encounters a "$DB::single=1;" line. I'm not sure exactly how to acheive this with a simple CGI script but this thread here Debugging CGI/PERL has some advice on that.
Once you have the debugger session you can monitor a variable by setting a watch expression (w NAME_OF_VARIABLE), which will be triggered whenever the value of the variable changes.
| [reply] |
| [reply] |
Devel::DumpTrace
"will cause a message to be printed to standard error for each line of source code that is executed. In addition, this module will attempt to identify variable names in the source code and substitute the values of those variables."
| [reply] |
Smart::Comments and Devel::Trace may also be of interest. With the former you'd just use it and add a comment like ### $my_variable where you want to see its value (and the nice thing is you just comment out the use Smart::Comments line and it becomes just a plain old inert comment that doesn't affect your program or its output).
The cake is a lie.
The cake is a lie.
The cake is a lie.
| [reply] [d/l] [select] |