Devel-ptkdb
view release on metacpan or search on metacpan
Uses the list of @regExprs as a list of regular expressions to set breakpoints. Sets breakpoints
on every subroutine that matches any of the listed regular expressions.
=item textTagConfigure(tag, ?option?, ?value?)
Allows the user to format the text in the code window. The option
value pairs are the same values as the option for the tagConfigure
method documented in Tk::Text. Currently the following tags are in
effect:
'code' Format for code in the text pane
'stoppt' Format applied to the line where the debugger is currently stopped
'breakableLine' Format applied to line numbers where the code is 'breakable'
'nonbreakableLine' Format applied to line numbers where the code is no breakable
'breaksetLine' Format applied to line numbers were a breakpoint is set
'breakdisabledLine' Format applied to line numbers were a disabled breakpoint is set
'search_tag' Format applied to text when located by a search.
Example:
#
# Turns off the overstrike on lines that you can't set a breakpoint on
# and makes the text color yellow.
#
textTagConfigure('nonbreakableLine', -overstrike => 0, -foreground => "yellow") ;
=item add_exprs(@exprList)
Add a list of expressions to the 'Exprs' window. NOTE: use the single
quote character \' to prevent the expression from being "evaluated" in
the string context.
Example:
#
# Adds the $_ and @_ expressions to the active list
#
add_exprs('$_', '@_') ;
=back
=head1 NOTES
=head2 Debugging Other perlTk Applications
ptkdb can be used to debug other perlTk applications if some cautions
are observed. Basically, do not click the mouse in the application's
window(s) when you've entered the debugger and do not click in the
debugger's window(s) while the application is running. Doing either
one is not necessarily fatal, but it can confuse things that are going
on and produce unexpected results.
Be aware that most perlTk applications have a central event loop.
User actions, such as mouse clicks, key presses, window exposures, etc
will generate 'events' that the script will process. When a perlTk
application is running, its 'MainLoop' call will accept these events
and then dispatch them to appropriate callbacks associated with the
appropriate widgets.
Ptkdb has its own event loop that runs whenever you've stopped at a
breakpoint and entered the debugger. However, it can accept events
that are generated by other perlTk windows and dispatch their
callbacks. The problem here is that the application is supposed to be
'stopped', and logically the application should not be able to process
events.
A future version of ptkdb will have an extension that will 'filter'
events so that application events are not processed while the debugger
is active, and debugger events will not be processed while the target
script is active.
=head2 Debugging CGI Scripts
One advantage of ptkdb over the builtin debugger(-d) is that it can be
used to debug CGI perl scripts as they run on a web server. Be sure
that that your web server's perl instalation includes Tk.
Change your
#! /usr/local/bin/perl
to
#! /usr/local/bin/perl -d:ptkdb
TIP: You can debug scripts remotely if you're using a unix based
Xserver and where you are authoring the script has an Xserver. The
Xserver can be another unix workstation, a Macintosh or Win32 platform
with an appropriate XWindows package. In your script insert the
following BEGIN subroutine:
sub BEGIN {
$ENV{'DISPLAY'} = "myHostname:0.0" ;
}
Be sure that your web server has permission to open windows on your
Xserver (see the xhost manpage).
Access your web page with your browswer and 'submit' the script as
normal. The ptkdb window should appear on myHostname's monitor. At
this point you can start debugging your script. Be aware that your
browser may timeout waiting for the script to run.
To expedite debugging you may want to setup your breakpoints in
advance with a .ptkdbrc file and use the $DB::no_stop_at_start
variable. NOTE: for debugging web scripts you may have to have the
.ptkdbrc file installed in the server account's home directory (~www)
or whatever username your webserver is running under. Also try
installing a .ptkdbrc file in the same directory as the target script.
=head1 KNOWN PROBLEMS
=over
=item I<Breakpoint Controls>
If the size of the right hand pane is too small the breakpoint controls
are not visible. The breakpoints are still there, the window may have
to be enlarged in order for them to be visible.
=item Balloons and Tk400
The Balloons in Tk400 will not work with ptkdb. All other functions
( run in 0.930 second using v1.01-cache-2.11-cpan-140bd7fdf52 )