CGI Lab

CS 325

Sept. 7, 2011

The purposes of this lab are to gain experience with form/CGI interaction and CGI.pm. CGI.pm is used to read the form parameters and generate dynamic HTML. Work individually, or in groups of two, on phoenix.

  1. You can see the final result at
    http://phoenix.goucher.edu/~kelliher/f2006/cs325/minmax.html .

  2. Login to phoenix. Create the directory cgi-bin as a sub-directory of public_html, which should be a sub-directory of your home directory. Make sure all three directories are readable by all. (First create public_html if it does not exist.)

    I've relaxed phoenix's Web server's permissions to allow you to execute CGI programs from this cgi-bin directory. This is the only directory from which you'll be able to have the Web server execute CGI programs. This permission will be extended until the end of the semester (Dec. 16).

  3. Copy the file ~kelliher/pub/cs325f11/minmax.html to your public_html directory. Change the action attribute of the FORM tag. Make the file public. Make sure it is visible to a Web browser.

  4. Copy the file ~kelliher/pub/cs325f11/minMax.cgi to your cgi-bin directory. Make it publicly executable. Make sure it is visible to a Web browser.

  5. Add code to the CGI program to print the name passed in. Test the program like this:
    % ./minMax.cgi name=Tom
    

  6. Add code to the CGI program to print the numbers in the parsed number list. Test the program like this:
    % ./minMax.cgi name=Tom list=1,5,9
    

  7. Add a minmax subroutine to the CGI program. This subroutine should accept a list of numeric parameters and return a two element list: the smallest number in the list, followed by the largest number in the list. Modify the program so that the name, min, and max values are printed. Test as before.

  8. Add code to the CGI program to generate an HTML document. Test as before. Make sure valid HTML is being generated.

  9. Test the form/CGI interaction by submitting the form from the browser.



Thomas P. Kelliher 2011-09-06
Tom Kelliher