[an error occurred while processing this directive]

Perl

Menu

Homework 6

In this assignment, you will use Perl to create a larger CGI application.

Create a Perl CGI application to function as a book library. When first run, your program will display all current books in the system, along with the book's author, publisher, year of publication, and how many times you've read it. It will also have the following options:

  • Add a new book. Provide a form for the user to enter the new book's title, author, publisher, and year of publication. Add this book to your library, with a read count of 0.
  • Search for a book. Provide a form for the user to enter search criteria, including each of the five fields mentioned above. Allow the user to select whether to search for books that match all or any of those fields. Show the matching books.
  • Delete book(s). Provide a means for the user to select one or more books to be deleted, and remove them from the list.
  • Read book. Provide a means of increasing a book's read count by one.

After completing any of these operations, your script should again show the (possibly updated) main list of books, with all five fields. Your main list must also have the ability to be sorted, by whichever of the five fields the user choose.

Structural Requirements

You must have only ONE executable .cgi script. You may write as many HTML::Template files as you wish (including 0 if you so choose). You may write whatever modules you wish. If you do write modules, please make sure you use the h2xs procedure we used for HW4, and that you name your modules with the Rcsid::ModuleName convention we followed for that assignment as well. Regardless of how many templates or modules you use, all of your executable code must be contained in one single .cgi file.

Do not hardcode the name of your .cgi script. When creating forms, leave the action blank, so that your form points to its own application.

Do not, DO NOT, DO NOT use any client-side scripting in your application. The only allowed languages for this assignment are Perl, HTML, and CSS. If I see any javascript, I may attempt to fail you for the course (not saying I would get that past the Dean, but I'd probably try...)

Helpful Hint

Those of you who plan on completing HW7 would be well advised to make your HW6 solution as modular and reusable as possible.

Grading Criteria

Show all books 10
Add new book 15
Delete books 15
Search for book 15
Sort books 15
Read book 10
Application Navigation 5
No Warnings 5
Code Style 5
Error Checking 5

No Warnings

Your code should produce no Perl-generated warnings. Your program can and should produce warnings when the user does something wrong (adding a book without a title, for example).

Error Checking

As alluded to above, you must make sure the user doesn't do anything wrong. Make sure all fields are filled in, that the user doesn't try to delete without selecting a book to delete, that at least one criteria for search is entered, etc. If the user does do something wrong, handle it gracefully. Print out an appropriate error message, and either allow the user to retry the operation, or return to the main book listing. Under no circumstances should your program crash due to a stupid user.

Code Style

Your code must be well styled, including meaningful variable names, consistent indentation, and explanatory comments. I don't remotely care what the HTML source you generate looks like - I'm talking about the Perl code only.

Application Navigation

In lieu of an "Output Style" criterion, you must make your application easy to navigate. The user should be able to quickly understand how to access each of the functionalities of your application. Forms and fields should be labeled, tables and links should be human readable, buttons should have meaningful names, etc. Under no circumstances should the User be forced to use the browser's "Back" button.

Penalties

As with all homeworks, failure to compile is a 50pt reduction. Late up to 14 hours is a 20pt reduction. Late greater than 14 hours is a 0.

Submission Instructions

To submit, run ~lallip/public/submit.pl on solaris.remote.cs.rpi.edu. Your application must be functional on www.cs.rpi.edu. You may submit infinte times, only the last submission will be graded. Your final submission is due 11:59:59pm EDT, Wednesday May 5, 2010

Perl Quotes
Perl Quotes