|
Exercise 1 Create this simple Perl script. Call it printenv.cgi, and give it a protection of 755. Try it. |
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
foreach $a (keys %ENV) {
print "$a = $ENV{$a}\n";
}
|
|
Exercise 2 Write an HTML page with a form that implements a search engine for your web site. See sample solution at right (replace user with your user name). |
<form method="GET" action="http://search.uoregon.edu/cgi-bin/query"> Search my site for: <input name="q" size="20" value=" +url:~user"> <input type="hidden" name="pg" value="q"> <p><input type="submit" value="Search"> or <input type="reset"> </form> |
|
Exercise 3 Write an HTML form that requests input and sends it as e-mail to yourself. Implement a user interface similar to the example at the right. |
Most books on basic HTML have a section on forms. More specialized books cover CGI scripting and Perl. For a different list of recommended books, see <http://www.calendarplus.com/amazon/allbooks.shtml>, or search Amazon.com for keyword "cgi". For Perl books, see also <http://www.perl.org/books/recommendations.html>. Here are a few typical titles: