There seems to be some misunderstanding of what CGI is and how it's utilized. Some people say it's just the way you pass parameters to and from scripts (url?some_var=some_val), but my understanding is that this is wrong. CGI is a specification for your web server to communicate with your script. The way it communicates is by a series of environment variables guaranteed to be there and with specific uses. For example, QUERY_STRING, REQUEST_METHOD, etc. These are all listed in the RFC. The nice thing about programming perl for CGI is that we have the nifty CGI module (or any of the other, smaller ones) that examines all those environment variables and provides functional or OO interfaces to the relevant information they contain. So instead of having to parse $ENV{'QUERY_STRING'} manually, the CGI module does it for us. In addition, the CGI specification provides a way to access things like the server name, the script name, the remote host, etc. The RFC describes this succinctly: The server acts as an application gateway. It receives the request
from the client, selects a CGI script to handle the request, converts
the client request to a CGI request, executes the script and converts
the CGI response into a response for the client. When processing the
client request, it is responsible for implementing any protocol or
transport level authentication and security. The server MAY also
function in a 'non-transparent' manner, modifying the request or
response in order to provide some additional service, such as media
type transformation or protocol reduction.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|