Configure Your Perl Script

Back::Home

This page is for those creating their own web site, but are struggling with a Perl script. Here I have attempted to explain in as basic a way as possible, how to configure a Perl script to Unix.

Perl is still the favored script for most web site designers wanting to create an interactive site. Whether your only requirement is to get some information back from an online form or you want to set up a secure shopping cart e commerce store, Perl handles it all with ease. There are more resources and scripts available for perl users than perl alternatives like PHP. This gives greater variety.

Configuring a Perl script to Unix is not as hard as it may first appear. The most common problem people have is getting the path address right.

Scripts on the net available for download for free usually come with no help to install, except at best a read me text file.

Many only require simple path alterations. Others may require more in depth work and knowledge. You will need to know HTML to alter the HTML embedded in most Perl Scripts, so that the new pages you create with the Perl script match the rest of your site. As you become more confident you will be able to alter the Perl itself. As already mentioned, there is a vast amount of Perl scripts on the net. There is one for every occasion and if you can learn a little Perl, you will be able to find a script to fit your needs and then shape it to your exact requirements. That way you do not need to spend hours learning the entire language.

For those that only require simple adjustments, like sendmail path, url of script location and root or file path or unix file path. You should be able to easily get the information required.

Open your ftp program, look in the folders provided by your Internet Service Provider (ISP). Some ISPs provide a text file with all the details you require. Other ISPs will have an online page providing this information. Others will have to be contacted for the information.

DO NOT open a .pl or .cgi perl script in a WYSIWYG, HTML Editor or similar. You will need to open it in a soft wrap editor. For example Wordpad or Notepad on windows or SimpleText on Mac.

The first line of the perl script always starts with #! then the location of Perl on your ISPs server. This is often #!usr/bin/perl but it varies. This short line of code is called the SHEBANG line. You have to find out what your ISPs perl location is and alter this line if necessary. If your ISP requires it you may have to specify perl5 if the script uses perl 5 . Look in the script creators copyright section of your script to see if there is any mention of perl 5. This is almost always at the top of the script page. If it is a new script, it may not mention perl 5. If it was made from say 2000 onwards you can probably take it for granted that it will be perl 5.

Where a script asks you for a URL or URL of where the script is located. Then you are looking for the full URL that you would use to view that page. If your script is going in to your CGI-BIN it may be as straight forward as http://www.your_domain.com/cgi-bin/script_name.cgi . Others may require http://cgi.www.your_domain.com/cgi-bin/www.your_domain.com/script_name.cgi . There are many variations. You have to check with your ISPs details.

Where the script asks for the location of your sendmail program, it is looking for the path to your ISPs mail programme. It may look like /usr/sbin/sendmail or /usr/lib/sendmail. You have to check with your ISPs details.

The file path or root is NOT a URL, it will not start with http or www. It is a file path so it is a list of folders. It may look like this /usr/your_domain/b/cgi-bin/script_name.cgi . You will need to get this path from your ISP. It will be very difficult to guess.

CHMOD commands are only tricky the first time you do them. These commands are there to stop people from interfering with your files. It allows them to interact or add information, without causing a security problem. You should be aware that there are two basic differences in the ways the commands are named. One is by numbers. So your script/ read me file may inform you that you should chmod the script to 775. The other way is by words or letters. rwx,rwx,x All permissions, All permissions, Execute. Your ftp program may be able to be altered between numbers and letters, depending on your preferences.

Your script may require you to set a chmod command on a folder as well as a file. Or if you created a folder in your cgi bin, you may have to set chmod commands on that folder for the script to work. This is not covered by some ftp browsers. However, if you contact the ftp program producers, they may be able to help you out.

Always up load every perl file in ASCii, otherwise it will not work. To do this you need to change the settings in your ftp programme.

I regret to say that I can no longer accept requests for free help above what is written here. I will gladly accept further information that may better help other readers of this page.

My Scripts;

  1. Chmod script
  2. Autoresponder script

Some useful perl sources;

Paul Munro 17th April 2001