RUN IT!!!
#!/usr/local/bin/perl
###########################################################################
# date.cgi #
# #
# This script was written by Selena Sol (selena@eff.org #
# http://www.eff.org/~erict) and amended by SHeizaf Rafaeli #
# (sheizaf@earthlink.net) having been inspired by countless other #
# perl authors. Feel free to copy, cite, reference, sample, borrow or #
# plagiarize the contents. However, please let me know where it goes so #
# that I can at least watch and take part in the development of the #
# memes. Information wants to be free, support public domain freware. #
# #
###########################################################################
# Set some server specific variables. You'll have to change these for
# your own system.
$graphic = "anim.clock.gif";
$return_url = "http://gsb.haifa.ac.il/~sheizaf/ecommerce/";
# Run the shell command "date" and assign the output to the variable $date
$date = `date`;
# Now $date looks like this: Wed Aug 16 09:17:55 EDT 1995. But
# since that is an ugly, unser-unfriendly format, we want to reorder
# the terms. So we assign to the array "@date" the contents of $date.
# Except we define the terms of @date, as each item separated by white space.
# @date now looks like this: WedAug1609:16:09EDT1995
@date = split(/\s+/, $date);
# Now we break up @date into its subcomponents so that each term in @date
# is represented by its own holder variable. This way we can reorder
# everything just the way we want them. Since there are 6 terms in
# @date, we need 6 holder variables.
$day=$date[0];
$date1=$date[1];
$day1=$date[2];
$time=$date[3];
$time1=$date[4];
$year=$date[5];
# Tell the server (communicating in MIME) to get ready to send an html
# document to the client. This is basically the mime "header".
# Make sure that this extra blank line is included! This is another MIME
# "command" which lets the server know that we are done with the MIME header.
print "Content-type: text/html\n\n";
# Begin by giving this new, created on the fly, document a title and
# head and all that "template" sort of stuff. And then send the results
# of the newly formatted date command to the browser. Note, in order for
# perl to understand that the "" in the link is not a perl command, and is
# something it is supposed to send to the browser, you escape them " with /
# BTW, the table and image are just there to make the page look nice but
# serves as a good template if you want to use nice formatting for an
# otherwise dull service.
print "The Time and Date";
print "";
print "";
print " | ";
print "
Today is: $day, $date1 $day1 $year
The time is: $time $time1
| \n";
print "
";
print "
";
# Okay, now include a little link back to the "scripts page so the user
# doesn't feel "stuck" on this drab little page. Finally, make sure to
# include those closing tags for tidy HTML coding!
print "Go back to the syllabus";
print ""