You can do a lot of cool stuff on your site with HTML; display basic pages, add images, play music, link to other sites ... the list goes on. But at some point, you'll probably want your page to be able to do even more. That's why Tripod offers a CGI service, with which you can easily add Perl scripts that will make your pages more dynamic. Want to gather information from your viewers or open a guestbook? Perhaps you'd like to write a game or set cookies. CGI scripts can do some pretty amazing things. We're here to help you learn how to use CGI on Tripod.
New to CGI scripts? Don't despair; Tripod's got you covered. We've written some useful scripts that you can plug directly into your page with no programming! You'll find them in our Script Library. Tripod has ready-made scripts for forms, random content, site search, and timely content. You'll be able to customize the script and then cut and paste it into your HTML pages. Couldn't be simpler. You can access the Script Library through the FreeForm Editor by clicking on the "Cool Page Features" pull-down menu. Or stop right here and go to the Library!
Still with us? Then you must know something about CGI. If you're itching to use your own CGI scripts (whether you wrote them yourself or carped them from someplace else), you'll need to be initiated, for CGI is bit different on Tripod! But it still boils down to a basic five-step process:
Step 1: Use your cgi-bin now.
Step 2: Upload Tripod's Perl modules.
Step 3: Go get your script.
Step 4: Put your script and associated files in the cgi-bin.
Step 5: Use your scripts on your Tripod pages.
Step 1: Use your CGI bin
So you know CGI we don't need to tell you what it is. Still, there are a few things you need to know about how CGI works on Tripod. You must put all your CGI scripts and associated files and modules into a specially designated directory on your Web server, which on Tripod is called "cgi-bin." Tripod differs from other CGI services in that all member-CGI scripts run on a special server named "cgi.tripod.com." While your scripts are running, the CGI server doesn't contact any other server on Tripod. This means a few things:
Since the CGI server won't contact any other servers on Tripod, any HTML or other file your script needs to access must be in your cgi-bin. You don't need to create the bin, we've done it for you. You can find it in your FileManager.
While a CGI script is running, Tripod's CGI server considers your cgi-bin to be the root directory. The sorts of things you can expect to find in a standard member's cgi-bin would be:
- CGI scripts, with a .pl or .cgi extension
- Perl modules, ending in a .pm extension; these should include all the Tripod modules and any module the user might have imported into the directory from another source.
- Any HTML file or text file that needs to be accessed by any scripts in the cgi-bin
Step 2: Upload Tripod's Perl modules
First, we've put together a few standard Perl modules (packages of functions) that will make your scripts work. You'll need to put them in the cgi-bin in your Tripod member directory along with your CGI scripts in order for the scripts to work. (Remember, all scripts, modules, and associated files need to be in your cgi-bin, or our servers won't find them!) You can use this collection of Perl modules, along with your cgi-bin, to make scripts work on any of your Tripod pages. These modules will allow you to do the following tasks:
- E-mail a message to a visitor.
- Get the current date and compare it against another date.
- Grab and save the contents of a form.
- Write a page to the screen with the dynamic content of your choice.
All Tripod modules are written in Perl. Perl allows you to use modules to encapsulate commonly used functions. Tripod's cgi-bin fully supports modules just put them into your cgi-bin directory and your scripts will find them. In addition to the modules, you'll find a file called "modules_readme.html." This file contains detailed instructions on how to use modules in your scripts, and lets you know what each module can do. You'll need to read it to effectively enable your scripts!
You will upload the following modules:
TripodCGI.pm
TripodDate.pm
TripodInsert.pm
TripodMail.pm
TripodPage.pm
CGI.pm
modules_readme.html
Load the modules directly to your cgi-bin on this page.
Step 3: Go get your script!
Whether you've written it yourself or picked it up someplace else, the only way to make a script work on your Tripod page is to dump it into your cgi-bin. Get a copy of your script and move onto Step 4.
Step 4: Put your script and associated files in the CGI bin.
There are three ways to get scripts into your Tripod cgi-bin. Any CGI scripts you put in your cgi-bin must have either a .pl or a .cgi file extension, or they won't work.
Write your own scripts here.
Or: Get a copy of your script and then go to the FileManager. Under the "File Options" drop-down menu, select "New Script." Paste your script code into the input box and save it.
Or: Upload your scripts to your Tripod cgi-bin using a stand-alone FTP program.
Step 5: Use your scripts on your Tripod pages.
The page or pages on which you use your script must live on Tripod servers. Those pages don't need to be in your cgi-bin, but they do need to be in your directory somewhere!
Tripod does not provide troubleshooting support for your CGI scripts. However, there are lots of valuable resources available for programming assistance:
Webmonkey: Programming CGI/Perl
http://www.webmonkey.com/programming/perl_cgi/
On Lycos:
http://dir.lycos.com/Computers/Programming/Internet/CGI/
http://dir.lycos.com/Computers/Programming/Languages/Perl/
On HotBot:
http://dir.hotbot.lycos.com/Computers/Programming/Internet/CGI/
http://dir.hotbot.lycos.com/Computers/Programming/Languages/Perl/WWW/