Programming in Perl

Fourth (and final*) Homework

*And there was much rejoicing

Create a CGI address book

FAQ now available

Due: Sunday, December 2nd, 11:59:59pm EST

You are to write a Perl CGI program which has 3 separate screens or 'modes':
  1. Logon
  2. View/Add/Remove Entries
  3. Email
Here is a description of each screen, and the options you must implement for each:
Logon Screen
This screen will have 3 inputs: A username box, a password box, and a login button. This is the first screen the user will see when (s)he accesses your CGI script. The user will enter his/her username and password (make sure the password isn't actually visible on the screen), and press the logon button. If the logon info is not correct, your program will print out an error message, and re-display this screen. If it is correct, your program will display the 2nd screen.
View/Add/Remove screen
This is the 'main' screen of the program. When this screen is loaded, your program will read from a program-specified datafile a list of entries. Each entry will have at least three fields: Last name, First name, and email address. You may have more fields if you wish (but don't plan on getting A&B credit that way). Your program will then print each entry out to a table - one entry per row, one field per column. The display must have the entries sorted by the Last Name field. After all the current entries, print one row containing blank fields for the user to enter a new address book entry. Also on this screen, you must provide functionality for the user to remove one or more current entries, and to email one specific entry.
If the user enters data in the blank fields and activates the 'Add new entry' functionality, your program will add the new entry to the datafile, and re-display this screen with the new information.
If the user activates the 'Delete entries' functionality, your script will remove the selected entries from the datafile, and re-display this screen with the updated information.
If the user activates the 'Email entry' functionality, your script will display the Email screen.
Email screen
When the user activates the 'Email entry' functionality from the previous screen, this screen is displayed. It contains a form consisting of blank fields for From:, CC:, BCC:, Subject:, and Body:. (The To: should also be shown, but not available to be changed on this screen.) When the user fills out all (or any) of the fields and presses an "Email Now" button, your script will send an email to the email address specified on the previous screen, with all the headers and message body specified in this screen's form. It should then print out a sucess message of some sort, and re-display the View/Add/Remove screen.

Notes

  1. Your script must accept the Logon of user: PerlF01 password: LarryWall (no spaces)(case sensitive, of course). Any other logon should be rejected.
  2. You need not worry about sessions, or cookies, or multiple users of any kind. Way beyond the scope of this assignment
  3. The descriptions of the Add, Remove, and Email functionalities are intentionally vague. You must decide how to implement these abilities in your program. These are the restrictions:
  4. Do NOT use javascript anywhere in this program. It's yucky. Likewise, don't use Java or anything else that's not either HTML or Perl.
  5. The name and format of the datafile is entirely up to you. You must decide what to name it, and how to store the information. Note that in general, the simpler the format of the datafile, the easier it is to parse.
  6. There is to be ONE file only. One file will create and display all there screens/modes
  7. You may either print 'straight' HTML tags, or use the CGI->HTML shortcuts, or some combination of both. Again, it's up to you.
  8. If the datafile does not yet exist, or is blank, the Add/View/Remove screen should simply print out a small message indicating this, followed by the blank fields to add a new entry. (Your functionalities to remove or email may still be there, but make sure they don't cause massive problems if activated...)
  9. You need not worry about a Log-off functionality, or returning to the Logon screen

Grading Criteria

As you should have guessed by now, 5 points are available for Above and Beyond credit.

Note that there will be an automatic deduction of 5% for anyone who does not follow the submission instructions correctly:

Submission Guidelines

When completed, send one email to both lallip@cs.rpi.edu and mcguij2@cs.rpi.edu (notice how both addresses have @cs). Make the subject of your email Perl Homework 4. Attach one plain-text file to your email: the CGI script. The name of the file is to be your RCS ID followed by '.cgi'. Make the body of your email have the following three or four lines: There is to be NO OTHER information of any kind within the body of your email.
* Once again I feel the need to explicitly state exactly what an "RCS ID" is. It is NOT the 9-digit number that replaced your Social Security Number this year. It is NOT either of the two numbers printed on your RPI ID card. It IS the alpha-numeric string you use to logon to the RCS network. It IS the piece of your email address that comes before "@rpi.edu". THIS is what you must include in your email.

The homework is due on Sunday, December 2nd at 11:59:59pm EST. It will be accepted up to 24 hours past the deadline at a deduction of 20%.