Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  Web Hosting FAQ  >  Learn how to troubleshoot Perl scripts
Top Scroll

Learn how to troubleshoot Perl scripts

 3 min

This article covers various ways through which you can troubleshoot your Perl scripts.

# Steps to troubleshoot Perl script

To troubleshoot the Perl script that is not functioning correctly, perform the following steps :

Step 1: To verify file permissions

To verify the file permissions, make sure that the Perl script file posseses the correct permissions set. The file permissions you set, depends on how the Perl script file is run.

Step 2: To verify the line break settings

For this, ensure that the Perl script file is in UNIX text format and not in the DOS format. The two formats encode line breaks differently, and script files that are saved in the DOS format may cause the syntax error when they are run(executed).

Step 3: To run the script from the command line

Debugging a Perl script through a web browser can be a difficult task. For example, if you receive an “Internal Server Error”, the root cause behind it could be file permissions, a syntax error, or completely something else. To obtain more information about scripts’ errors, you need to login to your SSH account and run the script from the command line. Type the following command to do so, where you will have to replace filename with the script filename :

perl filename

If there’s an error, the Perl interpreter will output detailed information about the type of error, and often the exact line number in the script file where the error has occurred.

To obtain more detailed information or to get the control over the script’s execution, you need to run the script in the Perl command-line debugger. Type the following command for it:

perl -d filename

Know more features and how to use Perl debugger at : https://perldoc.perl.org/perldebtut.html

# To check the webserver error logs

This step applies only to Perl scripts that are run as CGI scripts through a user’s web browser. Whereas, Perl scripts that are run on the command line do not log errors in the web server logs.

Perl scripts that cause a “500 Internal Server Error” or “403 Forbidden” error messages are logged in the web server’s error log.

Also Read :

1) {Introduction} – Perl Script Basics

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.