Category: | CGI Programming |
Author/Contact Info | Ellen Knowlton Wilson (ailie) |
Description: | This is a small script (one of my first) that will display a random quote from a file on a webpage. It allows the use of HTML tags in the quotes. I'd be interested in any constructive criticism people have to offer. Mea culpa - I didn't use CGI. I must have had a brain bubble or somesuch when I posted this. Sigh... |
#!/usr/bin/perl -Tw use strict; my $data = "/path/to/quotes/here"; my $output; $/ = "\n"; $data = '/path/to/quotes/here'; open DATA, $data or die "can't open data file: $!\n"; srand; rand($.) < 1 && ($output = $_) while <DATA>; print "Content-type: text/html\n\n\n"; print "<HTML><HEAD><TITLE>this is the random quote server</TITLE></HEA +D>\n"; print "<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\" LINK=\"#0047D5\" ALI +NK=\"#005500\" VLINk=\"#000080\">\n"; print "<FONT FACE=\"Arial, Helvetica, Sans Serif\"><BR><BR>\n"; print "<p><CENTER><BLOCKQUOTE>$output</BLOCKQUOTE></CENTER>"; |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: CGI Random Quote Server
by quidity (Pilgrim) on Dec 02, 2000 at 23:08 UTC | |
Re: CGI Random Quote Server
by AgentM (Curate) on Dec 02, 2000 at 10:05 UTC |
Back to
Code Catacombs