This tutorial is simular than the previous, but now we will run the script on our web host and debug it in optiperl. You will need to be connected to the internet to continue.
Let's assume your site is www.mysite.com. Upload cookie.cgi in it's cgi-bin folder. You should be able to run the script now using http://www.mysite.com/cgi-bin/cookie.cgi
To debug however in OptiPerl, upload with the following as the scripts first line:
Or just add the -d parameter. If you have setup the transfer session to automatically change the shebang line to your servers path to perl, then when uploading using "Save to remote location" or by publishing, OptiPerl will put the correct shebang and append the -d parameter you added.
If you uploaded with the -d parameter, the script will not run on your web host. You can only debug it. Read below for more information.
Adding the -d parameter will tell perl on our remote host to invoke the debugger when running the script (in our case we will run it by accessing the URL http://www.mysite.com/cgi-bin/cookie.cgi). However the problem is that perl will also need to know were in the entire internet it should connect the debugger to! We need to tell it to connect to our machine running OptiPerl.
Select menu Debug / Setup & Information. Press the tab "Setting up using remote session". Select the transfer session you used, and enter in the path the remote path you uploaded cookie.cgi, this will probably be /cgi-bin. Press Upload files. This sends the configuration files needed to tell the debugger on the remote web host to access our machine.
Select now menu Debug / Listen for remote debugger.
Now we have to access the script. Either select open remote script and run the remote file, or enter manually in the Browser menu the URL "http://www.mysite.com/cgi-bin/cookie.cgi". A connection to OptiPerl should be made and the source file downloaded so you can trace it.
Try not to trace into known good modules like CGI.pm, because this is unessesary, and also if you have a slow connection you will have to wait for them to download (if not saved in OptiPerl's cache). So when you are about to trace a line calling a subroutine of CGI.pm, like the header and cookie subroutines, press "Step Over" instead of "Single Step". Or enter a break point somewhere in your script and then press "Continue script".
Depending on the speed of your internet connection, the responce time after pressing "trace over" or "single step" might not be instant.
IMPORTANT: 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 with transfer 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.