You can use Komodo to debug Perl programs locally or remotely, including debugging
in CGI environments. See below for instructions on configuring Komodo to debug Perl
programs. For general information about using the Komodo debugger, see
Komodo Debugger Functions.
Specify which Perl interpreter Komodo should use to debug and run
Perl programs.
To specify the Perl interpreter:
- From the Edit menu, select Preferences.
- In the Preferences dialog, click Perl.
Komodo looks for Perl interpreters on your system and lists them in this
dialog.
- If your preferred interpreter is in this list, click to select the
interpreter.
If your preferred interpreter is not in this list, enter the path and file
name or click Browse to locate your preferred interpreter.
- Click OK.
Perl debugging is enabled on the Debugger Preferences page.
Top
Komodo's Remote Debugger is used to execute a Perl program on
another machine and debug the program using Komodo.
You can also remotely debug programs on non-Windows machines, as long as Perl is
installed on the remote machine. While Komodo requires ActivePerl 623 or higher, earlier versions
of Perl will probably work on remote systems. As long as your system can compile the
Komodo-aware version of perl5db.pl, remote Perl debugging will work. To debug Perl
programs remotely, perform the following steps.
Note - If you have the ActiveState Perl Development Kit (PDK) installed, follow
the instructions for PDK users to disable the
PDK debugger before you continue.
To debug Perl programs remotely:
Step One: Configure the Remote Machine
- Connect to your remote machine and log in.
- Copy the version of perl5db.pl that is distributed with Komodo to the remote machine.
If you installed Komodo in the default location, the file can be found in the
C:\Program Files\Komodo-x.x (where x.x is the Komodo version)
directory, or in the root install directory
on Linux. This file is also available for download from the
Komodo Remote Debugging page. On the remote machine,
copy this file to the directory that contains the Perl program you want to debug remotely.
Alternatively, you could create a new directory for Komodo's perl5db.pl and copy the
Komodo version of the file to the new directory.
Note: do not copy perl5db.pl to the "lib" directory on the remote machine, as this will
overwrite the standard perl5db.pl file with the version specific to Komodo.
- On the remote machine, specify the location of Komodo's version of perl5db.pl.
In a command shell, enter the following:
set PERL5LIB=path_to_perl5db.pl (where "path_to_perl5db.pl" is the directory
where Komodo's perl5db.pl. resides)
For example, if the remote machine is running Windows and perl5db.pl was copied to
the directory C:\misc\perl, enter the variable as follows:
set PERL5LIB=C:\misc\perl
If the remote machine is running a flavor of Unix and perl5db.pl was copied to the
directory /usr/home/me/perl/vperl_debugger, enter the variable as follows:
export PERL5LIB=/usr/home/me/perl/vperl_debugger
- On the remote machine, set the
PERLDB_OPTS variable, which will tell the Perl
program on the remote machine to connect to the Komodo debugger on the local machine.
- The RemotePort port number must match the port number specified
for the Perl Listener Port in Komodo's
Debugger Preferences.
- Replace the RemotePort hostname with the domain name of the local
machine running Komodo.
- Remote Debugging is not available on Windows 9x systems.
- The variable definition must be on one line.
The syntax of the variable is as follows:
Windows 2000, NT, XP
set PERLDB_OPTS=RemotePort=hostname:9010 PrintRet=0
Windows Me
Use the MSCONFIG utility (Start|Run|MSCONFIG). Select the Environment tab, and
create a new variable with the Variable Name of PERLDB_OPTS , and the
Variable Value of RemotePort=hostname:9010 PrintRet=0 .
Unix Systems
export PERLDB_OPTS="RemotePort=hostname:9010 PrintRet=0"
Step Two: Start Komodo's Remote Debugger
In the Komodo workspace, from the Debug menu, select Listen for Remote Debugger.
A Listening for Connection window opens and indicates the port number
for the process.
Step Three: Start the Perl Program on the Remote Machine
Start the debugging process by entering the following:
perl -d program_name.pl
For example, if you were debugging our sample Perl program, sample_perl.pl,
you would enter:
perl -d sample_perl.pl
Step Four: Debug the Perl Program using Komodo
In the Komodo workspace, debug as usual. You can step into functions and examine
variables as if you were debugging locally.
Note - If you have the ActiveState Perl Development Kit (PDK) installed,
follow the instructions for PDK users to
re-enable the PDK debugger.
Top
If you have the ActiveState Perl Development Kit (PDK) installed on your remote machine, Perl Remote Debugging is a bit
more involved. Your PDK installation sets a flag in the registry to use the
PDK debugger when a Perl debug session is launched. When you want to use
Komodo's Perl Remote Debugger, you need to disable the
PDK debugger on the remote machine. Then you can use the Perl Remote Debugger. When you finish
using Komodo's Perl Remote Debugger, remember to re-enable
the PDK debugger on your remote machine.
You can also debug Perl programs from
the command line.
Note - If you do not have the ActiveState PDK installed, follow
the instructions for Using the Perl Remote Debugger.
To disable the PDK debugger on the remote machine, perform one of the following three procedures:
Option 1:
- At the command shell, enter
set PERL5DB=BEGIN { require 'perl5db.pl' }
or
Option 2:
- Right-click the My Computer icon and select Properties.
- Click the Advanced tab.
- Click Environment Variables.
- In the System variables section, click New...
- Set the Variable Name field to PERL5DB.
- Set the Variable Value field to BEGIN { require
'perl5db.pl'}.
- Click OK button three times to exit.
Note - These changes takes effect
only in new DOS windows.
or
Option 3:
- Change the registry setting for HKEY_LOCAL_MACHINE\SOFTWARE\Perl
Rename the variable "PERL5DB"
to "xPERL5DB"
Note - You need to restore the variable when you want to use the PDK
debugger again.
Warning - This registry setting is semi-permanent and persists
through machine restarts. When you want to use the PDK debugger, ensure you change the environment variable
back to PERL5DB.
Top
To re-enable the PDK debugger on the remote machine, perform one of the
following three procedures. Select the same option that you used to disable
the PDK Debugger. For example, if you used Option 2 to disable
the PDK Debugger, use Option 2 below to re-enable the PDK Debugger. If
you select another option, you may experience strange system behavior.
Option 1:
- At the DOS prompt, set the PERL5DB variable to the empty string:
set PERL5DB=
Press return immediately after the
"=".
or
Option 2:
- Right-click the My Computer icon and select Properties.
- Click the Advanced tab.
- Click Environment Variables.
- In the User Variables table, select "PERL5DB" in the first
column.
- Press Delete.
If you deleted the wrong setting, press Cancel repeatedly to
get out.
- Otherwise, click OK twice to exit.
Note - This change takes
effect only in new DOS windows.
or
Option 3:
- Rename the registry variable "xPERL5DB" back to
"PERL5DB".
Note - This change takes effect only in new DOS windows.
Top
We strongly discourage you from debugging CGI programs on live production servers, as this
can seriously impair performance. Instead, we recommend you use a test server for CGI debugging.
We have included instructions for configuring Microsoft IIS and Apache (unix) servers; for other
web servers, use these examples as a guide for modifying the server environment.
- Modify the Server's Environment Variables To access the server's environment
variables, right-click the My Computer icon on the desktop, and select
Properties .
On the Advanced tab, click the Environment Variables button. Add the
following items to the System Variables pane:
PERL5LIB=c:\Program Files\Komodo-x.x where x.x is
the Komodo version and where PERL5LIB indicates the location of
the Komodo installation on the client machine
PERLDB_OPTS=RemotePort=hostname:9010 PrintRet=0 where
the RemotePort hostname is the domain name of the local machine running
Komodo, and the port is the port number configured as the
Perl Listener Portin Komodo's
Debugger Preferences).
- Modify the Internet Information Services Configuration Open the Internet
Information Services manager. Select the
Home Directories tab, and click the
Configuration button. Add an entry for Perl with the following characteristics (if an entry
already exists for Perl, modify as necessary):
Extension = .pl
Executable Path = c:\perl\bin\perl.exe -d "%s" %s (where the path indicates
the location of the Perl executable on the server)
- Restart the Server You must restart the server in order for the above changes to take effect.
Ensure that Perl CGI scripts are operating correctly on the Apache server before
proceeding with CGI debugger configuration. If you are running Apache under Windows, disable the
"ScriptInterpreterSource " registry in the httpd.conf file.
- Modify the
httpd.conf file The following values can be
configured for a specific virtual host, or globally for all hosts. Add the following values in the
appropriate sections:
SetEnv PERL5LIB c:\Program Files\Komodo-x.x where
x.x is the Komodo version and where the path indicates the location
of the Komodo installation on the client machine)
SetEnv PERLDB_OPTS RemotePort=hostname:9010 PrintRet=0
(where the RemotePort hostname is the domain name of the local machine running
Komodo, and the port is the port number configured as the
Perl Listener Portin Komodo's
Debugger Preferences).
Note: You must enable the mod_env Apache module (see
httpd.apache.org/docs/mod/mod_env.html)
for the SetEnv directive to function.
- Modify the Perl Script Change the shebang line as follows:
#!/perl/bin/perl -d (where the path indicates the location of the Perl executable
on the server)
After the configuration is complete, debug programs as follows:
- In Komodo, on the Debug menu, select Listen for Remote Debugger....
- Using a web browser, access your CGI script.
- Use Komodo to debug the Perl program.
Top
To debug Perl programs from the command line:
- Ensure the shell variable entries for PERL5LIB and
PERLDB_OPTS are empty. The following
commands clear them on Windows systems:
set PERL5LIB=
set PERLDB_OPTS=
Top
|