Authoring/Development - rand_text.pl
rand_text.pl is a script that takes text you specify and randomly displays it on your Web site. It must be copied to your own Web directory and modified for your own use.
You will normally want to place rand_text.pl in a CGI directory, although this is not strictly required (because it has the .pl extension, it will execute as CGI from any directory).
To begin, copy the script into your Web directory. Use this sequence of commands when logged in by SSH:
cd ~/public_htmlNext, use your favorite text editor to modify the script. You will need to set two variables within the script:
cp /usr/www/cgi-bin/rand_text.pl cgi-bin/.
This is the path to your text file (for example, /usr/www/users/USERNAME/example.txt).$delimiter
This is what delimits the text in the file. For example, if you were putting quotations on your site, this is how the program will know when one quotation stops and another starts. The default is set to "%%\n", which means that in your text file you'll need to put a line between each quotation with two percents, like this:To display the quotations on your site, include this code in your HTML wherever you want them to appear:
- Some Guy
- Someone else
<!--#exec cgi="/cgi-bin/rand_text.pl" -->Since this is SSI, you'll need to make sure your HTML filename ends in .shtml, not .html. For more information, please see our article on SSI.