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':
- Logon
- View/Add/Remove Entries
- 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
- Your script must accept the Logon of user: PerlF01 password:
LarryWall (no spaces)(case sensitive, of course). Any other logon should be
rejected.
- You need not worry about sessions, or cookies, or multiple users
of any kind. Way beyond the scope of this assignment
- 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:
- Do not use pop-up boxes or extra screens to get more info from the
user
- The user must be able to remove any number of entries without
needing to activate the functionality more than once. In other words,
the user can select which entries to remove, choose "Delete", and the
script will be able to remove all the selected entries at once.
- 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.
- 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.
- There is to be ONE file only. One file will create and display
all there screens/modes
- You may either print 'straight' HTML tags, or use the CGI->HTML
shortcuts, or some combination of both. Again, it's up to you.
- 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...)
- You need not worry about a Log-off functionality, or returning to
the Logon screen
Grading Criteria
- Display logon screen: 5
- Invalid logon redisplays first screen: 5
- Valid logon displays View/Add/Remove screen: 10
- V/A/R screen displays all entries, sorted correctly: 10
- Add new entry: 15
- Remove selected entires: 15
- Select entry and activate Email functionality: 5
- Email screen displays all fields: 5
- Email successfully sent from Email screen: 10
- Return to V/A/R screen after Email: 5
- Display appropriate Error messages: 5
- Code style: 5
- Output style: 5
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:
- Your name
- Your RCS ID*
- The complete URL of your CGI script
- Your Above & Beyond attempt, if any
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%.