#!/usr/local/bin/perl #------------------------------------------------------------------------------# # PROGRAM: quote.cgi (a daily quote server) # NOTE: this CGI program should be called from a server-side # include (SSI) statement. #------------------------------------------------------------------------------# # Copyright 1998 DevDaily Interactive, Inc. All Rights Reserved. #------------------------------------------------------------------------------# # This is the name of the quote-server database file $quoteFile = "quotes.db"; # first, get the day of the month $dayOfMonth = (localtime(time))[3]; # next, open the quote database file. open(QDB,"$quoteFile") || die "Content-type: text/html\n\n

Error opening quote database file.\n"; # Next, read through the database until we find a line that matches # the $dayOfMonth. (Note: no error-checking is done here currently.) until ( $currentLine == $dayOfMonth ) { $currentLine = ; } # *Assuming* that the $dayOfMonth was found, we should now be positioned at # the "

" line. print "Content-type: text/html\n\n"; # Next, print each line from the database until the closing #
tag is found. until ($currentLine =~ /<\/BLOCKQUOTE>/) { $currentLine = ; print $currentLine; } close(QDB); # All done! exit;