ActiveState Community

debugger

Restoring the native Perl debugger

OS: Windows | Product: Perl Dev Kit | tags: debugger
Question: 

How do I switch back to using the native Perl command line debugger?

Answer: 

When the Perl Dev Kit is installed, the PDK's Graphical Debugger becomes the default debugger, replacing the console debugger included with your Perl distribution.

To disable the Graphical Debugger included with the Perl Dev Kit and use the console debugger instead, perform the following steps:

  1. Ensure that the Graphical Debugger is set to remote mode.
    • On the command line, enter pdkdebug --query to view the current mode.
    • If necessary, enter pdkdebug --remote to set the debug listener to local mode.
  2. Set the debugger to the console debugger included with Perl 5.x. On the command line, enter:
        set PERLDB_OPTS=

To disable the Graphical Debugger permanently, remove the PERL5DB key from HKEY_LOCAL_MACHINE\SOFTWARE\Perl and remove the PERLDB_OPTS system environment variable.

Batch file for switching to/from PDK Debugger

OS: Windows | Product: Perl Dev Kit | tags: debugger environment
Question: 

How can I quickly switch between using the PDK Debugger and the command
line debugger?

Answer: 

Here is a batch file for manipulating the relevant environment variables:

@ECHO OFF
SET MODE=%1

IF "%MODE%" == "PDK" GOTO PDK
IF "%MODE%" == "CLI" GOTO CLI
ECHO "no valid input? usage: DBSET "
ECHO "possible modes PDK or CLI"
GOTO END

:PDK
SET PERL5LIB=C:\Program Files\ActiveState Perl Dev Kit 6.0\lib\
SET PERL5DB=
GOTO REPORT

:CLI
SET PERL5LIB=""
SET PERL5DB=BEGIN { require 'perl5db.pl'; }
GOTO REPORT

:REPORT
ECHO Debugger mode set to %MODE%

:END

Copy the code into a file called DBSET.BAT, and move it into a directory in your PATH (e.g. C:\Perl\bin).

To use perl's regular command line debugger:

C:\> DBSET CLI

To use the PDK Debugger:

C:\> DBSET PDK