This article describes several ways you can troubleshoot your Perl scripts.
When you have a Perl script that is not functioning correctly, you can follow these troubleshooting steps:
Make sure that the Perl script file has the correct permissions set. Which file permissions you set depends on how the Perl script file is run. For more information about the correct file permissions for Perl script files, please see this article.
Make sure the Perl script file is in UNIX text format, and not DOS format. The two formats encode line breaks differently, and script files saved in the DOS format may cause syntax errors when they are run.
Trying to debug a Perl script through a web browser can be difficult. For example, if you receive an “Internal Server Error”, the root cause could be file permissions, a syntax error, or something else entirely. You can obtain much more useful information about script errors by logging in to your SSH account and running the script from the command line. To do this, type the following the command, replacing filename with the script filename:
When there is an error, the Perl interpreter outputs detailed information about the type of error, and often the exact line number in the script file where the error occurred.
If you need even more detailed information or control over the script's execution, you can run the script in the Perl command-line debugger. To do this, type the following command:
perl -d filename
The Perl debugger has many features. For more information about how to use the Perl debugger, please visit http://perldoc.perl.org/perldebtut.html.
This step only applies to Perl scripts that are run as CGI scripts through a user's web browser. 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 message are logged in the web server's error log. You can use cPanel to view the error log for your web site.
Usamos cookies con el fin de personalizar para usted nuestro sitio Web y analizar el uso de éste. Usted acepta esto haciendo clic en “Acepto” o al continuar usando el sitio Web. Hay más información sobre cookies en nuestra política de privacidad.