Linguistics 408/508
Fall 2003
Hammond

Handout 18

Overview

CGI review

  1. .cgi
  2. public_html/cgi-bin
  3. chmod a+x program.cgi
  4. "Content-type: text/html\n\n"
  5. #!/usr/bin/perl
  6. $ENV{QUERY_STRING}

Form review

Practice

  1. Make an HTML page that includes a title on the titlebar and on the page, and that includes text instructing the user to enter some text.
  2. Put that page on syntax.sbs.
  3. Revise that page using pico so that there is a form with a textarea that the user can enter text in and a submit button that will submit the form.
  4. Make sure there is an action attribute that anticipates the name of a CGI program that you will write.
  5. Write a first version of the CGI program that simply prints a message saying thank you. Run it with the web page you've created to make sure it all works.
  6. Revise the CGI program so it collects the text entered and prints it out back verbatim.
  7. Revise the CGI program so it uses the CGI.pm module to decode the URL encoding in the query string, and prints back that text.
  8. Revise the CGI program so that you also perform some useful statistical analysis on the text entered, e.g. how many words or characters in the text, how many capitalized words. It should display these statistics in the returned page.
  9. Finally, revise the CGI program so that it transforms the text in some interesting way. The information returned should include the original text (after URL decoding) and the transformed text.