next up previous contents
Next: Getting your data Up: User's guide for Free Previous: Support for gprofthe

CGI programming in Free Pascal

 

In these days of heavy WWW traffic on the Internet, CGI scripts have become an important topic in computer programming. While CGI programming can be done with almost any tool you wish, most languages aren't designed for it. Perl may be a notable exception, but perl is an interpreted language, the executable is quite big, and hence puts a big load on the server machine.

Because of its simple, almost intuitive, string handling and its easy syntax, Pascal is very well suited for CGI programming. Pascal allows you to quickly produce some results, while giving you all the tools you need for more complex programming. The basic RTL routines in principle are enough to get the job done, but you can create, with relatively little effort, some units which can be used as a base for more complex CGI programming.

That's why, in this chapter, we will discuss the basics of CGI in Free Pascal. In the subsequent, we will assume that the server for which the programs are created, are based upon the NCSA httpd WWW server, as the examples will be based upon the NCSA method of CGI programminggif.

The two example programs in this chapter have been tested on the command line and worked, under the condition that no spaces were present in the name and value pairs provided to them.

There is however, a faster and generally better uncgi unit available, you can find it on the contributed units page of the Free Pascal web site. It uses techniques discussed here, but in a generally more efficient way, and it also provides some extra functionality, not discussed here.





Michael Van Canneyt
Thu Sep 10 13:56:17 CEST 1998