The perl ptkdb is a graphical perl debugger, written in perl Tk.
You can use it for normal perl scripts, but also for perl
CGI
script in a web server environment.
You can download it from
http://world.std.com/~aep/ptkdb/
You only have to add the parameter
-d:ptkdb in the first line of the
CGI script. Then you have to make the debugger visible:
- on Windows, start the apache.exe as a normal process (e.g. from a command prompt).
- on Unix, set the DISPLAY environment in the CGI script.
The Unix part is done with the following lines:
#!/usr/bin/perl -d:ptkdb
sub BEGIN { $ENV{DISPLAY} = "yourmachine:0.0"; }
--
StefanScherer - 11 Mar 2001
Just tried this on Windows (
Win2K + Apache +
ActiveState perl). Worked a treat.
--
JohnTalintyre - 21 Mar 2001
[Instructions for use with CygWin Perl moved down a bit]
Some useful resources on Perl/Tk:
--
RichardDonkin - 29 Mar 2002
Just got this to work on Windows 2000 Pro with
ActiveState Perl 5.6.1 build 630.
Note that this requires that you have Visual C++ installed (I have VC++ 6.0 sp 6). You may find it as a binary by running "perl ppm", but I don't know that for a fact.
- [ JohnTalintyre - 2 Apr 2002 ] - I've had this without VC++ and would suggest that if you are using ActiveState then use ppm to install
- ppm
- search ptkdb (to check it's there)
- install
- (this should deal with dependencies for you, but any problems do same for TK).
- At a dos console: perl -MCPAN -e shell
- At the cpan prompt: install Tk and some longish time later it's built and installed, along with Tix and god knows what else.
- At the cpan prompt: quit
- Download the pktdb package as above.
- Using Winzip, drag 'n drop the pktdb.pm file to C:\perl\dev (or whatever your path to perl is) as suggested by the readme file in the .tgz file. If you have an earlier version of winzip without file d 'n d, just select the file and extract it to the perl/debug dir (and don't use directory paths; you want it in the perl/dev dir, not a subdirectory) - no need to unpack the whole tgz.
- Test in a console with perl -d:pktdb -e 1
Et viola! A perlish debugger pops up! YMMV
--
DavidLeBlanc - 29 Mar 2002
I got this working with Cygwin, using Cygwin Perl 5.6.1 and Apache 1.3.22 (Cygwin), and it's very nice!
- Install Tk for Cygwin from Gerrit Haase's site
- download the .tar.bz2 file, then run the Cygwin Setup tool, doing an install from directory pointing at this file. This uses the Win32 APIs for the GUI, i.e. it doesn't require XFree86.
- Use the
cpan tool to install Devel::ptkdb
- Test in a console with
perl -d:ptkdb -e 1
- Update the shebang line on the
view script to add -d:ptkdb, and remove the T (taint) option, so it looks like #!/usr/bin/perl -w -d:ptkdb
- Start Apache from a shell window, e.g. using Cygwin's
apachectl start, not as a service (I used Apache for Cygwin) - if using TWikiOnCygwinApacheScripts, do srv-apache-stop.
- Test by running
./view from the command line, from the twiki/bin directory.
- Test by using the
view script through a browser.
This doesn't require commercial development tools such as Visual C++, so it's a good option where they are not available.
Note that removing the taint option is not a good idea in the longer term, as it helps to pick up coding errors that could cause security problems. Also, it would be good to get it working with Apache running as a service.
--
RichardDonkin - 02 Apr 2002
I just tried John's tip about installing with
ActivePerl's
PPM, and it worked fine:
C:\> ppm
PPM interactive shell (2.1.5) - type 'help' for available commands.
PPM> search ptkdb
Packages available from http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:PPMServer:
Devel-ptkdb [1.1074] Perl debugger using a Tk GUI
PPM> install Devel-ptkdb
Install package 'Devel-ptkdb?' (y/N): y
Installing package 'Devel-ptkdb'...
Bytes transferred: 42552
Installing C:\Perl\html\site\lib\Devel\ptkdb.html
Installing C:\Perl\site\lib\Devel\ptkdb.pm
Writing C:\Perl\site\lib\auto\Devel\ptkdb\.packlist
PPM> quit
Quit!
I didn't have to install anything else, and Visual C++ was not needed - this was with
ActivePerl 5.6.1, build 630.
It's well worth getting
ptkdb working - you can hover the mouse over a variable in the source code to see its current value, and it's very easy to set breakpoints. You can even see hash-of-hashes structures (as in
CVS:bin/statistics
) shown as a tree!
--
RichardDonkin - 02 Apr 2002
Has anyone tried the
ddd debugger
with perl? Perhaps a new topic could be started on this if folks are interested. I would appreciate feedback about this.
I am in part drawn to this for selfish reasons. ptkdb isn't packaged for Debian GNU/Linux, while ddd is! I heard about these kinds of tools on
TWikiIRC.
--
GrantBow - 25 Jan 2003
I had no trouble installing ptkdb via
CPAN from Debian. Works great. I prefer to enable mod_env for apache and then add this like to the "bin" <Directory> entry:
SetEnv DISPLAY :0
Which sets the DISPLAY environment variable appropriately without needing to add a BEGIN block to the Perl code.
--
WalterMundt - 26 Jan 2003