in reply to Re: Debugging a CGI
in thread Debugging a CGI

You don't need ptkdb nor X. I've debugged CGIs using the standard Perl debugger while telnet'd into the web server. Sorry, I don't have the details handy. I had to chmod the pseudo tty that telnet gave me so that the world could read/write it, then modify the CGI script to invoke the Perl debugger and tell it to use that tty as the debugging console.

I don't recall exactly what method I used to tell the Perl debugger to use an alternate tty. You can use the PERLDB_OPTS environment variables and/or the .perldb (or perldb.ini) config file but I suspect either of these will require a trick similar to:

#!/usr/bin/perl -w use strict; BEGIN { if( @ARGV && $ARGV[0] eq "-debugging" ) { shift @ARGV; } else { $ENV{PERLDB_OPTS}= 'TTY=/dev/pty06'; chdir('/home/tye/cgibin') or die "Can't chdir to /home/tye/cgibin: $!\n"; exec( $^X, "-d", $0, "-debugging", @ARGV ); } }
(though I'm not sure $^X will always be sufficient so you might have to hard-code "/usr/bin/perl" there to match your #! line.)

        - tye (but my friends call me "Tye")