Perl

Menu

Homework 3

This assignment will involve creating a larger program, involving subroutines, multi-dimensional structures, and more regular expressions.

Write a program to serve as a rudimentary trouble ticket manager. When your program is run, it will provide the user with a menu of options. If the program is started with a command line option, that is a filename that contains the current ticket management system, so read that file in. Menu selections are:

  1. Add New Ticket
  2. Show Ticket by ID
  3. List My Assigned Tickets
  4. Show All Tickets
  5. Update Ticket
  6. Add Note
  7. Search Ticket Descriptions
  8. Save All
  9. Exit

Add New Ticket

Prompt the user for the ticket's short description, owner, severity (1-5), and finally long description. Store this information, along with the current date/time, and display the new ticket's assigned ticket number.

Show Ticket

Prompt the user for a ticket number, and display that ticket's short and long descriptions, owner, severity, date/time, and all notes with their date/times

List my Assigned Tickets

Display the ticket number and short descriptions of each ticket that is owned by the current user. Do not hardcode the user name. Use my $user = getpwuid($<); instead.

Show All Tickets

Prompt the user to sort by ID, owner, severity, or date/time. Display each ticket's ID, short description, owner, severity, and date/time in the specified order.

Update Ticket

Prompt the user for a ticket number. Prompt the user which piece of information to change - either short description, owner, or severity. Take in the new information and save the ticket.

Add Note

Prompt the user for a ticket number. Prompt the user for a new note for this ticket. Save the new note and the current date/time for the note.

Search Ticket Descriptions

Prompt the user for a search term or phrase. Return a list of the ids and short descriptions of eachc ticket that matches the search term as follows:

  • Single Word - all tickets that contain that word
  • Space-separated sequence of words - all tickets that contain any of those words
  • Phrase surrounded by "..." - all tickets that contain that exact phrase (without the quotes)
  • word1 AND word2 AND word3 <etc> - all tickets that contain all of those words, but not necessarily in a phrase

Save All

If the program was started with a filename, write the contents of the ticket management system to that file. If not, prompt the user for a filename to write to, and then save. You should only prompt the first time - on subsequent saves, your program should remember the filename.

Exit

Exit the program

Structural Requirements

While I generally dislike making specific requirements about your choice of algorithm or data structure, the realities of an academic environment force me to do so in this case. Therefore:

  1. Each of the 9 menu options must be associated with their own subroutine. You may choose to call the subroutine as soon as you've identified the menu option, or prompt for relevant information before calling the subroutine, but each option's main workload must be contained in a subroutine.
  2. Your program must make good use of at least one multidimensional structure. What the two or more dimensions are (hashes, arrays, or objects) is up to you. "Good use" is defined as being an integral part of your program, not simply declared and never used.

A 20 point penalty will be imposed for each of these requirements which are not met.

Grading Criteria

Read DataFile from command line 5
Add a New Ticket 10
Show Ticket by ID 10
List Assigned Tickets 10
Show All Tickets, in proper order 15
Update Ticket 5
Add Note 12.5
Search Ticket Descriptions 15
Save Tickets 2.5
Error Checking 5
Code Style 5
Output Style 5

Penalties

Late and Compilation Penalties remain the same from HW1 and HW2. Don't forget about the two new penalties for Subroutines and MultiDimensional Structures as described above.

Error Checking

Whenever the user does something "wrong", print out an appropriate warning message and either reprompt for correct data or return to the main menu. Under no circumstances should your program exit early because of bad user input. Some of the bad inputs possible could include invalid menu option, invalid severity, invalid ticket number, etc.

Code Style

Your code should be easily readable to a human being. Most imporant are consistent indentation, explanatory comments, and meaningful variable names. Please see also perldoc perlstyle for a guide to well-styled Perl code.

Output Style

Your output should be easily readable to a human being. All output should be labeled, white space should be used to increase readability.

Submission Instructions

To submit, run ~lallip/public/submit.pl on solaris.remote.cs.rpi.edu and follow the prompts. You may submit infinite times, only the last submission will be graded. Your submission is due by 11:59:59pm Eastern Time, Tuesday, March 18, 2008.

Perl Quotes
Perl Quotes