95.205C/D
Internet Applications

Assignment 2

This assignment is due on Friday, March 2, 2001, at 2:00 pm

Instructions

These are the instructions for completing assignment 2: Print a copy of the answer sheet and use it to hand in your answers to this assignment.
 

Part 1

In this part you will create three CGI scripts: Please adhere to those names in your solution.

Note: You don't have to implement a home page in HTML. It should be generated by the CGI script.

Shop205Home.cgi

When the user selects the flower image in the web page created for assignment 1, the associated link requests the Shop205Home.cgi script. This script sends the following web page to the user:





When the user clicks the submit button labeled "Show Selected Categories", the Shop205DisplayCategories.cgi script is called.
 

Shop205DisplayCategories.cgi

The Shop205DisplayCategories.cgi script dynamically creates a web page that displays the items available in the selected categories. For example, if the user selected "Roses" and "Orchids", the following web page would be created and sent to the user:



Shop205Order.cgi

The Shop205Order.cgi script is called when the user clicks on the button labeled "Place Order" in the page displayed by the Shop205DisplayCategories.cgi script. The Shop205Order.cgi script then dynamically creates a web page that thanks the user for their order, lists the items to be ordered (including the type, description, and price of each item), and states the total cost of order (including 7% GST and 8% PST).

Note: At this point we won't store the order on the server. You will be asked to do this in the next assignment.
 

Part 2

A common complaint about CGI programming is the mixing of program code (in our case Perl) with HTML. Templates allow for the separation of program code from HTML. In this part of the assignment, you will create and use HTML templates so that the HTML and Perl program code can be separated in your scripts. The HTML templates can also be "re-used" with different data.

Suppose that just after you completed Part 1 of the assignment, you were asked to build a similar site for an online CD vendor. Had you used templates to build the the first application (for the online flower vendor), the work necessary to build the second site would have been marginal.

HTML::TEMPLATE

Download the HTML::Template module and install it on your course account. Documentation is also available.

Shop205Home.cgi Revisited

A template is now used to provide the structure of the web page, and the script provides values for the following variables: The objective is to use these variables as parameters to TMPL_VAR and TMPL_LOOP tags.

Shop205DisplayCategories.cgi Revisited

A template is now used to provide the structure of the web page, and the script provides values for the following variables:

Shop205Order.cgi Revisited

A template is used to provide the structure of the web page, and the script provides values for the following variables: