good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^2: Using the Perl Debugger (-d)by rinceWind (Monsignor) |
on Jan 26, 2007 at 10:31 UTC ( [id://596687]=note: print w/replies, xml ) | Need Help?? |
Now if they just had one that would help monitor Tk apps... Debugging Tk is a different ball game. Using ptkdb doesn't play well as it introduces widgets and Tk events of its own, which potentially interact with and interfere with the application you are trying to debug. It is possible to use perl5db on a Tk application, but using a debugger on any event driven system, like Tk or POE will always be tricky, because if your debugger is prompting you, the code cannot be servicing events. You will see your GUI freeze until you resume the application, though you can manually get GUI changes by calling $mainwindow->update from the debugger prompt. The approach I tend to use is to rely primarily on logging, capturing stdout and stderr in my command window's scrollback. A technique I have used is to add a debug menu under "File" on the main window's menu bar. Here's an excerpt from one of my Tk apps:
Note that the list of checkbuttons on the debug menu is created dynamically, adding a new checkbutton each time debug() is called with a different parameter. Here's an example of my using the debug function from the same application:
--
In Section
Seekers of Perl Wisdom
|
|