[prev] [index] [next]

CGI Script Structure

CGI scripts can interleave computation and output.

Arbitrary interleaving is not generally effective
(e.g. produce some output and then encounter an error in middle of table)

Useful structure for (large) scripts:

  • collect and check parameters; handle errors
  • use parameters to compute result data structures
  • convert results into HTML string
  • output entire well-formed HTML string