tina.cgi Index

Overview of tina

tina.cgi is a little Perl script that will pick a random line from a data file and insert it in your HTML document using SSI. The latest version of this script can always be found at <http://rock13.com/webhelp/perl/tina/>

Use a simple text editor, such as notepad, to create and configure these files. If you have trouble getting tina to run, or are new to CGI and Perl, see my Webhelp: Perl (online).

Contents

Downloading

You can download it in either of the following formats. Unzip them as you would any other compressed file, refer to your unzipping software or operating system for instructions.

tina.zip (3.86 KB)

tina.tar.gz (3.43 KB)

SSI - Server Side Includes

You will need to enable SSI for this script to work. If you don't know if you can use SSI, or are not sure how, take a look at Art Sackett's Grey Paper: SSI For The Rest of Us for a quick intro on how to get SSI enabled.

Creating The Data Files

The data files are plain text files. Each line is a new entry and must be separated by a single carriage return (ENTER key). The text is simply inserted into the HTML document so it may contain HTML.

The data files must be in the /cgi-bin/ or a readable subdirectory of it. A sample data file (default.dat) is included.

Configuration

If you have some experience with Perl, then the comments in the tina source should be adequate. However, I have tried to explain everything as clearly as possible in this document. The only thing that must be configured is the first line of the file.

  1. Shebang! #!/usr/bin/perl

    Change the first line in tina.cgi to point at perl on your server. The default may work. Type which perl from a Telnet prompt to find the location.

  2. $default = 'default.dat';

    This is the file that tina will use if you do not specify a different one in the query string of the SSI. You can use the included file, create your own, or just not bother with it if you intend to always specify a data file. I recommend leaving it named default.dat to avoid confusion.

  3. $warning = 'red';

    This is the color that any debugging warnings will be printed in. The default is 'red' and should work fine, no one sees it but you. You can use any format for the color that is valid in HTML.

  4. $debug = 0;

    This will print some errors to the screen to help you get the script working. One is on and zero is off. The default is off.

Uploading The Files

You should have tina configured and have one or more data files, now you need to upload them. For this you need an FTP client, any OS worth the silicon its stored on should have a command line FTP. Alternatively you may want to download ws_ftp a popular graphical FTP program.

  1. Be sure to upload the files in ascii.
  2. Upload tina.cgi to your /cgi-bin/ then chmod 755 tina.cgi (or whatever you need to do to get it executable).
  3. Upload the data files to the /cgi-bin/ or a subdirectory of it. You should not need to change permissions on these files. But chmod 644 [filename].dat will do it.
  4. Place the SSI directives in the files you wish to execute tina from. Use the following format, or equivalent: <!--#include virtual="/cgi-bin/tina.cgi?file.dat" --> Where 'file.dat' is the name of the data file you wish to use.
  5. Ensure that the HTML file you are executing tina from is being parsed for SSI.

Bugs

Maybe you screwed up. Alright, I haven't run this on a wide variety of systems and am a novice perl programmer. So if you encounter a problem let me know at <webmaster@rock13.com>.


Copyright©2000 Rob - Rock13.com