giraffe/;
# Recover the previous animals from the magic cookie.
# The cookie has been formatted as an associative array
# mapping animal name to the number of animals.
# Recover the new animal(s) from the parameter 'new_animal'
# If the action is 'add', then add new animals to the zoo. Otherwise
# delete them.
foreach (@new) {
$zoo{$_}++;
}
}
# Add new animals to old, and put them in a cookie
# Print the header, incorporating the cookie and the expiration date...
print header(-cookie=>$the_cookie);
# Now we're ready to create our HTML page.
print <<EOF;
<h1>Animal Crackers</h1>
Choose the animals you want to add to the zoo, and click "add".
Come back to this page any time within the next hour and the list of
animals in the zoo will be resurrected. You can even quit Netscape
completely!
<p>
Try adding the same animal several times to the list. Does this
remind you vaguely of a shopping cart?
<p>
<em>This script only works with Netscape browsers</em>
<p>
<center>
<table border>
<tr><th>Add/Delete<th>Current Contents
EOF
;
print "<tr><td>",start_form;
-multiple=>1,
-override=>1,
-size=>10),"<br>";
print end_form;
print "<td>";
print "<ul>\n";
}
print "</ul>\n";
} else {
print "<strong>The zoo is empty.</strong>\n";
}
print "</table></center>";
print <<EOF;
<hr>
<ADDRESS>Lincoln D. Stein</ADDRESS><BR>
<A HREF="./">More Examples</A>
EOF
;
print end_html;