Remote debugging means running a script on a remote machine, but controlling it's flow on the machine running OptiPerl. Remote debugging can also be used via loopback, to invoke the debugger after an html page calls a script.


icon_idea The window Debug / Setup & information provides detailed help and tools for configuring remote debugging. It is also updated automatically if your computer connects to the internet or a network, or changes it's IP.


icon_exclaim Remote debugging requires OptiPerl to act as a server on port 9010. If you are running a firewall or Windows XP Internet Connection Firewall, make sure proper privileges are given to OptiPerl.


Debugging via loopback


To debug remotely via loopback, do the following:


  • Make sure you have configured OptiPerl so that the script or other scripts in the same folder can be run with the option Server / Run with server enabled.
  • Open the script you want to debug and add a -d parameter to it's shebang. For example:


#!perl -d


  • Select Debug / Listen for remote debugger.
  • If you have the internal server enabled, select Run. The debugger should be invoked and the execution line should go to the first line of the script.
  • To invoke the script from an html page, load the page and invoke the script (like by pressing the submit button). The same result as above should occur.
  • You can do the same from an external or secondary browser.


If you are using an external server, make sure that the computer's environment settings contains a line like:


PERLDB_OPTS=RemotePort= ReadLine=0


If however you are using the internal server, this is not needed, as the internal server add's this automatically to the script's environment.


See also menu Debug / Set-Up & Information window / Debugging via Loopback for more information and setting up if you are using an external server.


icon_idea Read the tutorial "Using the remote debugger via loopback" for an example.


Debugging on a remote machine


To debug on a remote machine, you will either need:


  • Access to it's environment settings, so you can add the PERLDB_OPTS setting. Most web hosts don't allow this however.
  • If it's running windows, access to it's registry. If the machine is connected via a network, optiperl can try to enter the required setting via a remote registry connection.
  • In most cases, just uploading two files (read below) will do fine. This is most common way to setup on most web hosts.


To setup:


  • Select File / Open remote file and open the file you want to debug on the remote machine.Add a -d parameter to the shebang. If you cannot open the file via File / Open remote machine, just make sure it has a -d parameter in it shebang (by uploading via project publishing, manually editing via the network etc).
  • Set up a line in the machines environment or registry to point the debugger to the computer OptiPerl is running like:


PERLDB_OPTS=RemotePort= ReadLine=0


Where the IP address of the computer OptiPerl is running on. Press the "Info" tab on the "Debug" pop-up window for more information about this.


If you do not have access to the environment or registry, upload the debugger configuration files via the "Set-up and Information" dialog on the tab "Setting up using remote session".


  • Select Debug / Listen for remote debugger, and invoke the script on the remote machine, either by running as a remote file if it's transfer session is set up, or invoking it by entering the URL to the script from any web browser.


When the script waiting to be debugged is runned, OptiPerl asks the remote debugger for the script's source code, so it can display it in the editor. This is why it is not necessary to actually have the script that is going to be debugged open in the editor. The source code when received, is saved locally in the Application Data folder. This way if you debug it again, it will not have to be downloaded again, unless of couse changes have been made, which OptiPerl will detect and query you to download again.


icon_exclaim You don't need any special version of on the remote machine. The standard version 1.07 that comes with most perl distributions will work fine (it is located in the folder \perl\lib\)


icon_idea Read the tutorial "Debugging a script located on your web host" for an example.


About the debugger used and a possible problem


OptiPerl accepts any connection made from the module included in the standard perl distribution. This module is called by default when you run perl -d from the console. However some third party debuggers might override the setting PERL5DB (either in the registry or by having it set in the environent) to invoke their own debugger. If this setting is set to a non standard debugging module, OptiPerl will not be able to process the data sent from the remote debugger. This is not a problem when debugging via loopback, becuse OptiPerl will make sure this value is not set.


If however you are debugging on a remote machine, you will have to make sure that on the remote machine this value is either unset or set with text like:


BEGIN { require "" }


  • Under UNIX, delete the environment variable PERL5DB if it exists.
  • Under Windows, also make sure that it does not exist in the registry under:




Delete or rename the key "PERL5DB". If the remote machine is a windows box and you are allowed to update the registry by double clicking a .reg file, use the "Setup & Information" dialog to create a .reg file and execute it on the remote machine.


Automatically setting up a remote machine via remote session


In most cases you can setup the remote machine via FTP or Secure FTP by creating and sending files named .perldb and perldb.ini to the same folder that contains the script you want to debug. The files must must containt a line of text like the following:


&parse_options("RemotePort=xx.xx.xx.xx:9010 ReadLine=0");


Where xx your IP adress. These files can be sent automatically using Menu Debug / Setup and information / Setting up via remote session, where you can select a remote session and path to upload to or delete from.


If the remote machine is connected via a windows network, OptiPerl can also try configuring it via a remote registry connection. See the corresponding tab in the Setup & information window.



icon_idea See "Debugging via loopback" and "Debugging a script located on your web server" in the tutorials section for a complete example.


icon_exclaim Important note when debugging on a remote machine (not important when debugging via loopback):


If you have a dial-up internet connection with a dynamic IP address, before disconnecting from the internet, delete the configuration files sent, by selecting Debug / Setup & information / Setting up using remote session / Delete files. Or delete the files .perldb and perldb.ini that were uploaded manually. If you don't, when you terminate your connection to the internet, and the temporary IP you had is assigned to another customer of your ISP, he/she could also create a debugging session with the scipt you were debugging. This also means ability to execute any perl function, and view/edit/delete all files on your web site.




Top  Previous  Next