CSE 341 -- Programming Languages

Autumn 2002

Department of Computer Science and Engineering, University of Washington

Steve Tanimoto (instructor)

Assignment 5

Version 0.1 of November 22 (Subject to Change)

Processing POSTs in Perl 

Due date and time: Thursday, December 5, 2002 at 11:59 PM.

Turn-in method to be announced.


 

Title: Processing POSTs in Perl

Purposes:

Instructions:
 
Reading I recommend that you read the entire little book on Perl called A Little Book on Perl by Robert W. Sebesta. You don't have to commit all this information to memory. Later, I'll provide a list of specific topics that you'll be responsible for on the final exam. Sebesta's book is concise and coherent, and it's probably easier to read it straight through than to continually jump around in it.
Part A (Common Required Functionality) Create a web page that contains the following:

Create a Perl program that runs as a CGI (Common Gateway Interface) "script" to process a user's submission from your HTML page. The processing should perform the following:
 
B. Suggestions for Individualization These are just suggestions to get you thinking. Each student should come up with something original. The processing should take advantage of Perl's regular expressions facilities.

Facilities Recommendations

Develop your Perl program either under Unix (Linux) or Windows. On a Linux host, you can run a program by typing
perl myprogram.pl
However, it will be difficult to supply input via CGI methods when you develop this way. Therefore, provide test input a different way when debugging your text-analysis method. Then you'll be able to take your working text-analysis code and combine it with the CGI input code to do the whole job.
 
Use Dante or Abstract as your web server, putting your script in a location where it can be run by the web server program. Be sure you set your Perl script to executable and contain an appropriate first line to allow it to be run as a script. Make sure your program prints a standard "header" string before it prints anything else, so that you don't just get "Internal Server Error: Premature End of Script Headers" whenever you try to run your script from the browser.

Documentation and Style

Write your Perl code in a reasonable, readable manner, using variable names that reflect their purposes. Limit the number of distinct constructs (loops, mapping, pattern matching, assignment) used in one line of code to approximately 3 or fewer. This will help prevent the code from getting too dense. Include comments in the code at an average rate of approximately one comment line per line of real code.
 
Provide a separate plain ASCII text file that documents your program. Include the following in this writeup:
 
Give the program a descriptive name.
 
Write the URL at which your HTML page can be found.
 
Explain the special functionality you are implementing. Explain the algorithm you are using to implement that functionality. If there is anything special a user of your program needs to know in order to understand the process or the results, explain that. If there are any special documents that best show off the features of your Perl script, provide URLs or (if they are not too big like more than a page) actual text for them.