Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 10.2 Importing Method GroupsChapter 10
The CGI.pm Module
Next: 10.4 Named Parameters
 

10.3 Maintaining State

One of the first complications for any nontrivial CGI script is how to "maintain state." Since HTTP is a stateless protocol, there's no built-in mechanism for keeping track of requests from the server end. A CGI transaction involving multiple forms, therefore, needs to find a way to remember information supplied on previous forms. One way to deal with this issue is to use cookies, which allow the CGI program to save information on the browser's end; but not all browsers support cookies, and some users are uncomfortable with the perceived privacy infringement associated with cookies.

CGI.pm simplifies maintaining state without cookies. When a CGI.pm script is called multiple times, the input fields are given default values from the previous invocation.


Previous: 10.2 Importing Method GroupsPerl in a NutshellNext: 10.4 Named Parameters
10.2 Importing Method GroupsBook Index10.4 Named Parameters

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.