With a few settings, you can enable the Perl debugger for scripts running under PerlEx. This enables you to debug scripts in the environment in which they will be running.
To configure debugging:
ScriptLocation
to the directory or the file you wish
to debug.PERLDB_OPTS
and PERL5LIB
variables
to the running script
Environment.
See below for specific instructions regarding setting these values for
debugging with Visual Perl, Komodo or the Perl Dev Kit.Notice that, with the above configuration, the debugger sockets will be kept alive between requests for a given script. This allows you to debug the persistent behavior of your scripts.
If you want to have the socket disconnected at the end of each request,
set the Interpreters
value to zero for your Interpreter Class, and add the "shebang" line
#!/path/to/perl -d
to the first line of your script.
Note that this will also disable the PerlEx precompiler and any persistence
of global variables.
In Step 3 above, configure the variables as follows:
Visual Perl
PERL5LIB=C:/path/to/VisualPerl/
PERLDB_OPTS=WatcherPort=localhost:WatcherPortNumber RemotePort=localhost:RemotePortNubmer PrintRet=0
Replace WatcherPortNumber and RemotePortNubmer with the port values configured in Visual Perl. The above settings are appropriate for Visual Perl version 1.2. Consult the Remote Debugging section of the Visual Perl User Guide for more information.
Komodo
- Copy Komodo's perl debugger and its associated libraries to the remote machine by copying the entire dbgp/perllib sub-directory of the Komodo installation to the new machine, or download a package from the Komodo Remote Debugging page. Note: Do not copy perl5db.pl to the Perl "lib" directory on the remote machine, as this will overwrite the standard perl5db.pl file.
- On the remote machine, set the
PERL5LIB
environment variable to the location of the new perl5db.pl and its libraries. For example, if the remote machine is running Windows and perllib directory was copied to C:\misc\perllib, set the variable as follows:set PERL5LIB=C:\misc\perllibFor example, if the remote machine is running Linux and perllib was copied to the /home/me/perl/komodo_perl_debugging directory, set the variable as follows:
export PERL5LIB=/home/me/perl/komodo_perl_debugging/perllib- On the remote machine, set the
PERLDB_OPTS
andDBGP_IDEKEY
variables. This tells the Perl interpreter on the remote machine where to connect to Komodo or the DBGP Proxy and how to identify itself.PERLDB_OPTS=RemotePort=<hostname>:<port> DBGP_IDEKEY=<ide_key>
- The port number must match the port number specified in Edit|Preferences|Debugger. Click Debug|Listener Status to check the current port.
- Replace
<hostname>
with the name or IP address of the machine running Komodo.- If DBGP_IDEKEY is unset, the USER or USERNAME environment variable is used as the IDE Key.
- The variable definitions must be on one line.
Consult the Remote Debugging section of the Komodo User Guide for more information.
Perl Dev Kit
PERLDB_OPTS=RemotePort=localhost:port PrintRet=0
Replace port with the value configured in the Perl Dev Kit debugger (by default, 2000). Note that if the Perl Dev Kit is installed on your system, and you wish to use Visual Perl or Komodo to debug, you may need to disable the PerlSock service. See the Visual Perl or Komodo User Guides for more information.