First ... Back ... Next ... Last ... (Notes home)

Perl for CGI

  • The CGI ("Common Gateway Interface") standard was developed in the early days of httpd, as a way for Web servers to interact with external programs, passing results to and from a Web client.
  • The basic idea is that the user's browser sends a group of key=value pairs, where the key is the name of a variable, and the value is that variable's value.
  • Two methods are available, but Perl can handle both: the GET method encodes key/value pairs as part of the URL, and the POST method uses the http command stream to send key/value pairs.
  • Use an HTML form to define the keys, as well as setting up types of data for input. Some good pages to get started are at Webmonkey, or get code at Matt's script archives.
  • Examples of input forms (including client-side Javascript data-checking) are everywhere on the Web. The syntax is simple.
  • Recommendation: use carp for CGI processing (see perldoc carp and man CGI::Carp)
  • . Here's a pretty good page with tutorial info: http://www.steve.gb.com/perl/lesson19.html

First ... Back ... Next ... Last ... (Notes home)

UAF Computer Science
Prof. Greg Newby