Ultrapresence. Business on the web. Call 1-877-691-5009 for orders and info. In Calgary call 398-8939.
Information On Perl
Show all 21 Categories

1. What version of Perl does my server use?
2. What are the absolute paths to Perl on the webservers?
3. How should I set my file permissions on a Perl script?
4. What are the correct file extensions for Perl scripts?
5. Should I upload my Perl scripts in ASCII or Binary mode?
6. Can I use a "cgi-bin" on my account for my Perl scripts?
7. Do my Perl scripts have to reside in a certain directory, such as the cgi-bin directory?
8. Are there a list of steps for debugging my Perl script(s)?
9. Do my Apache error_logs contain any useful information?
10. Are there other places to turn for help?

1. What version of Perl does my server use? [ top ]

Perl version 5.x.

timestamp: 2003/09/18

---------------------------------------

2. What are the absolute paths to Perl on the webservers? [ top ]

Below are all of the current absolute paths to Perl on all webservers: /usr/bin/perl

timestamp: 2003/01/17

---------------------------------------

3. How should I set my file permissions on a Perl script? [ top ]

Often times, permissions are set very leniently in order to avoid any permissions problem. This is not a good idea. Your Perl scripts should have the appropriate permissions depending on the function of that particular script. First, all scripts should be set to the owner (you) having read, write and execute privilege (rwx) regardless of the function of the Perl script. Next, you should ask yourself if you want people (visitors) to your website to be able to execute the Perl script. This is most likely the case. Under these conditions, your script would be set to world readable and executable (r-x). Do not give the world write permission on the Perl script! It is not necessary and may lead to problems! If your script is not going to be executed through the web and only you will be executing the script through Telnet (there are various reasons for having a script operate under these conditions), then you set the script to no world permissions (---). The group permissions should be set to read and executable (r-x) if the script is to be executable via the web. Otherwise, set your group permissions to nothing (---). With this information, you have the following permissions breakdown: Executed via the web by anyone: chmod 755 Executed by only yourself through the command line: 700 Often times, a Perl script will open a file for writing. This is the case in guestbooks and bulletin boards, where the information is received from the form and written to a certain file. The permissions of this particular file are now important. Many times, the author of a Perl script you use on your account will require you to set this file to rwxrw-rw-, or chmod 766, which allows write access to the world. This is not a good idea and is unnecessary. Files that need to be written to by way of a Perl script can be set to the default permissions of rw-r--r--, or chmod 644. This will work fine with our setup. Finally, never set your file permissions to rwxrwxrwx, or chmod 777. This is not necessary, may cause a security problem on your website, and will cause your Perl script to not execute at all!

timestamp: 2003/01/17

---------------------------------------

4. What are the correct file extensions for Perl scripts? [ top ]

Your Perl scripts can have the extension .pl or .cgi. However, Perl scripts that are going to produce output to the web (world readable) would use the extension .cgi. Perl scripts that are only meant to be executed by yourself via the command line or even scripts which may be executed through the web without any output should be set to the .pl file extension.

timestamp: 2003/01/17

---------------------------------------

5. Should I upload my Perl scripts in ASCII or Binary mode? [ top ]

You should always upload your Perl scripts in ASCII mode via FTP. If you upload your scripts in binary mode, the scripts will not work and you will get an "Internal Server Error: Premature End of Script Headers" error (500 Internal Server Error). It is very important to remember to only upload your Perl scripts in ASCII mode!

timestamp: 2003/01/17

---------------------------------------

6. Can I use a "cgi-bin" on my account for my Perl scripts? [ top ]

Yes. In fact, a cig-bin is already configured for you in the "/cgi-bin/".

timestamp: 2003/09/18

---------------------------------------

7. Do my Perl scripts have to reside in a certain directory, such as the cgi-bin directory? [ top ]

Yes. This is the ONLY location where cgi scripts should be set to execute. Please place all of your cgi scripts in the "/cgi-bin" directory.

timestamp: 2003/12/17

---------------------------------------

8. Are there a list of steps for debugging my Perl script(s)? [ top ]

Below is a list of steps to go through to troubleshoot any problematic Perl scripts. These are the same troubleshooting methods employed by the technical support repetitive at ultrapresence.com:

  1. Gather Information about the Problem
  2. Execute the Perl script through the command-line.
If the output indicates a syntax error with the Perl script. The problem has been identified as a problem with the code in the Perl script. If the error "Command not found." is returned at the prompt, do the following:
  1. Check the permissions on the actual Perl script. Must be executable!
  2. Retry. If it still fails, then check the permissions on all directories leading up to the Perl Script. They must be set to rwxr-xr-x, or chmod 755.
If the script will execute (possibly return HTML output) through Telnet, but still gets an "Internal Server Error" through the web, do the following:
  1. Ensure that the file permissions are set to rwxr-xr-x, or chmod 755.
  2. Ensure that the file permissions are not set to rwxrwxrwx, or chmod 777.
At this point, you must know the source of the problem, whether it be a permissions problem or a syntax error within the Perl code itself. Now all you must do is fix it!

timestamp: 2003/01/17

---------------------------------------

9. Do my Apache error_logs contain any useful information? [ top ]

It depends. When a Perl script encounters an "Internal Server Error" for whatever reason or a "Forbidden" message when executed via the web, useful information is logged to your error_log, located in your logs directory. When you execute Perl scripts through the command line, any errors encountered are not logged to this file. The usefulness of this file applies only to the execution of Perl scripts through the web. A good technique is to open the Server Administration tool to view the log files online. You can execute a troublesome Perl script through the web and refer to your error log immediately to see any useful information placed in your log file.

timestamp: 2003/12/17

---------------------------------------

10. Are there other places to turn for help? [ top ]

Yes. Because of its widespread popularity, there are many places on-line that have valuable resources for troubleshooting Perl scripts. Below are some of the most useful resources: http://www.webdeveloper.com/categories/cgi-perl/ The Official Perl Site For scripts that you can use on your site visit: The CGI Resource Index Matt's Script Archive

timestamp: 2003/12/17

---------------------------------------

/images/right_banners_domain.gif
Contact Info
© 1998-2003 by Ultrapresence
Privacy Policy
Legal Info