#!/usr/bin/perl -w push(@INC,"/www/cgi-bin"); require 5.003; require "cgi-lib.pl"; #-------------------------- What This Does ---------------------------- # As a program becomes longer, it becomes easier to understand if it # is broken into subroutines, each of which contains one part of the # program. This is thus a "cosmetic" modification of the revious one. #---------------------------- Configure ---------------------------- $vote = "http://www.math.upenn.edu/~kazdan/210/vote/vote3.html"; #Election Form #---------------------------- Main Program ---------------------------- &ReadParse; print &PrintHeader; &Preliminaries; # If something is missing, print an error message and return to form. if (($in{lastname} eq "") || ($in{firstname} eq "") || ($in{"pres"} eq "")) { &missing; } else { # Their ballot is complete. &Thanks; # Thanks &ClosePage; } # end Main Program #--------------------------------------------------------------- sub Preliminaries { # Next is a useful "Return to the Form" button. $header = '
Return to Voting Forms Page
'; } # end Preliminaries #--------------------------------------------------------------- sub missing { # The only trick here is how to switch to a new URL after giving # 3 seconds to read the error message. The Election 2000 error $header  
To vote, you must include your First and Last names as well as your Vote.

In a few seconds your Election Ballot will be returned. error } # end missing #--------------------------------------------------------------- sub Thanks { print <Election 2000 $header  

To:   $in{firstname} $in{lastname}

Thank you for voting. (One more vote for "$in{pres}"). ok } # end Thanks #--------------------------------------------------------------- sub ClosePage { # This closes the HTML page. print < end } # end ClosePage