Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.

In reply to Re: CGI program by saberworks
in thread CGI program by manishrathi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-18 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found