#!/usr/local/bin/perl #File:calendar4.pl use CGI; $CAL='/usr/bin/cal'; @years=(1990..2010); $query = new CGI; #Set the year to the query, otherwise the current year if($query->param('year')){ $year=$query->param('year'); }else { chop($year=`date +%Y`); } # Print the header and the top of the document print $query->header; print $query->start_html('Calendar'); print "

Calendar for $year

\n"; # ------------------- CREATE THE FILL-OUT FORM ------------------- # Print the popup menu for the year. print $query->start_form; print "YEAR: ",$query->popup_menu(-name=>'year', -values=>\@years, -default=>$year); # Print the checkbox for Julian calendar. print $query->checkbox(-name=>'julian'),"

"; # Submit button print $query->submit(-label=>'Make Calendar'); # end the form print $query->end_form(); # ------------------- PRINT THE CALENDAR ------------------- unless ($year=~/^\d{4}$/) { print "ERRORYear must be exactly four digits\n"; exit 0; } $extra_switches = '-j' if $query->param('julian'); chop($calendar_text=`$CAL $extra_switches $year`); print < $calendar_text


Welcome Page END ; print $query->end_html();