Linguistics 408/508 |
Fall 2003 |
Hammond |
Handout 18
Overview
- Questions from last time
- CGI and Forms review
- CGI and Forms practice
CGI review
-
.cgi
-
public_html/cgi-bin
-
chmod a+x program.cgi
-
"Content-type: text/html\n\n"
-
#!/usr/bin/perl
-
$ENV{QUERY_STRING}
Form review
- This page
summarizes the critical options that are
available for each of the simple form objects
covered in the book.
Practice
- 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.
- Put that page on
syntax.sbs
.
- 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.
- Make sure there is an
action
attribute that anticipates the name of a CGI
program that you will write.
- 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.
- Revise the CGI program so it collects the text
entered and prints it out back verbatim.
- 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.
- 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.
- 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.