Debugging your Perl scripts
This FAQ will give tips to help you debug your Perl script
When running CGI Perl scripts you might come across certain errors - these tips will help you resolve some of the more common errors.
If you encounter an error “500 Internal Server Error” whilst running your CGI perl scripts, try the following in order:
- Ensure you have uploaded the script through FTP using ASCII mode, or that it has Unix-style carriage returns.
- Check the perl interpreter on the first line of the script. It should always be “#!/usr/bin/perl”.
- Make sure the script filename ends in either “.pl” or “.cgi”.
- Make sure the script can execute. It should have mode “0755”. You can change this in your file manager – set the mode to user read+write+execute, group read+execute, other read+execute. Most FTP clients also support this.
- Put “use CGI::Carp qw(fatalsToBrowser);” into the second line of your script. This will make perl print the error instead of the “500 Internal Server Error” page, and will allow you to find out where your script is breaking.