Images on this site were compressed using e-Vue MPEG4 technology in 2001, which was groundbreaking at the time for its DRM component and higher compression than JPG, however e-Vue is no more we are transitioning these images to JPEG for 2004.
Most modern Web servers can run scripts as either filename.cgi, or filename.pl, and most servers can run cgi-scripts in any directory, and not just the "cgi-bin" (some hosting providers use "cgibin" as the default instead of "cgi-bin" so check with your provider, and adjust your config variables as needed). In Figure 2, you can see I have a second "cgi-bin" called "cgib," which has a shopping cart script in it.
Putting it Together For your first practical application, choose a simple script with only a couple of files, like a form script or something similar. Assuming you have a PERL script in hand, and youve looked at the readme.txt or whatever documentation, know your proper paths, and have edited your config variables, then simply upload the file(s) where indicated, set permissions, then navigate with your browser to the script, and try to make it go.
If you get "not authorized" errors, this is usually because you missed a permission someplace. If you get an "internal server error" then this is most likely a bad directory path, or URL pathits telling you it cant find something it needs to work, and so it failed to work at all. Some scripts have a debug mode, which if set to "on" (often by setting a variable to "Y" or "1" in the script), may print a more specific error to your browser screen, like "sorry, cant locate tmp directory." Sometimes an internal server error can also be because of permissions, such as a directory setting being too restrictive, and the script couldnt write a temporary file to it.
Assuming everything else is done right, and a script still doesnt work, it might be because its too old, or because it requires some kind of write privilege, which is no longer supported by most servers. This is common with many free PERL scripts written back in 1996 and 1997, especially those that write files to a directory, like a hit counter script. Essentially, the server is saying, "No, you cant write to that directory like that," and it will always fail. In this case, look for a newer script.
What Are They Good For Scripts are a wonderful thing, because they allow static HTML pages to add exciting and dynamic content. Youve likely been to a site that had weather, stocks, your horoscope, celebrity birthdays, current news, and the like. All of this is coming from a script of some kind, because HTML pages dont do anything by themselves. They are really gussied-up text pages that have been tricked over the years into including images and fancy table-based layouts. The fact is, all that is being done by the browser, and not the page itself. Scripts do the work and make content available to the browser, which is how your site visitor sees it.
Figure 5: Example of script folded into site content, showing local
weather.
A really cool example of the power of a free PERL script is a script called HamWeather (hamweather.com). This script allows you to create your own local weather portal, or build that content into your existing content. If you look at Figure 5, you will see an example of how I added local weather and a four-day forecast to my Long Beach "beach cam" page on my hosting site. It took about 20 minutes to install, and another 20 to make it look the way I wanted amid my own layout. The script automatically pulls data from the National Weather Service, and puts in the appropriate weather graphics automatically.
The best starting point for finding PERL scripts is one of my favorite sites on the Web, cgi-resources.com, which has over 1900 PERL scripts covering everything from calendars, to form handlers, online auctions, surveys, and shopping carts. Most are free, many of the others are low-cost. Typically, the more business-oriented scripts tend to cost the most.
If you start with something simple, then move on to more complex scripts, you will find it surprisingly easy to tell your next client "Sure, I can do that."
Christopher Simmons has been creating Web sites since 1995 and is president of Neotrope, which offers Web design and brand marketing services. E-mail him at cs@digitalauthor.com. A version of this article appeared in the March 2001 edition of Micro Publishing News.