Windows Environment for Remote Perl Debugging

Posted by ericp on 2008-01-24 11:00
OS: Windows | Product: Komodo | tags: remote perl debugging

How do I start a Perl debugging session in Komodo from the command-line?


This is a variant of remote debugging, which is covered in Komodo help. But
since it's a frequently-asked question, I thought I'd put a note here.

First, make sure Komodo is listening on a specific port using
Preferences|Debugger|Connection, and make sure the option for
"Komodo should listen for debugging connections on:" is
"a specific port:". We conventionally use port 9000, but you can
choose any free port.

Second, I set these environment variables in a Windows command shell:

set PERLDB_OPTS=RemotePort=localhost:9000
set kodir=c:/Program Files/ActiveState Komodo IDE 4.2/lib/support/dbgp/perllib
set PERL5DB=BEGIN { require q(%kodir%/ }
set PERL5LIB=%kodir%

Use forward slashes in the paths on Windows. These values will be used
by Perl, and while it can use backslashes, you have to take the trouble
to make sure they're correctly escaped. Forward slashes raise no such problem.

Unlike Unix/Linux/OS X, don't quote arguments. If you do, the quotes end up
as part of the environment variable's value, and Perl doesn't
expect that.

Debugging a Perl program is then a simply launched like so:

perl -d

Yes, it's the same way you start a command-line debugger session, but the
environment variables direct Perl to use Komodo's debugger.