eWebProgrammer eweb  

Web Perl   «Prev  Next»
Lesson 8 Getting started with CGI
Objective Explore the role of MIME headers in a CGI program.

Getting started with CGI

Because the process of running your first CGI program is complex enough in itself, we will first consider a simple CGI program that sends a brief message back to your browser before we pursue the added complexity of using forms.
A CGI program sends its output back to the client as part of the response from the server.
Because this can be any sort of output that a Web client can handle, you need to first specify what sort of data you will be sending. Usually it will be HTML (just another Web page for all intents and purposes), but since it's possible to send anything, you will need to explicitly tell the client what you are sending.

The first output from the CGI program is a MIME header that specifies what format the output is using.
Mime headers are explained on this page.