In the book "CGI programming with Perl", it was stated that CGI is a protocol. Does it mean that its something like HTTP ?

Not quite. CGI is a protocol, but it is not a network protocol. It is a protocol defining a method which is used by web server software to interact with other software running on the same host.

But for using HTTP or LDAP or SQL, we dont use any API. We just open the interface on client machine for LDAP and SQL and comunicate.

And how do you "open the interface on the client machine"? You run a piece of software which uses the appropriate API to access the underlying protocol to communicate with the HTTP/LDAP/SQL server. Or, if you're writing the client software which does so, you either use an existing API to access the protocol or you implement the protocol yourself.

If a program is written in Perl and CGI API is used in it, is that a Perl program or CGI Program ?

Yes. It is both. It is a Perl program which uses CGI. It is also a CGI program written in Perl.

What does it mean when .cgi extension is used ? When shall we use .cgi extension ?

The .cgi extension is used to indicate to the web server software (Apache, IIS, etc.) that the file should be executed through the CGI interface instead of sending the file itself to clients requesting that URL. For Apache, this is established by the command "AddHandler cgi-script .cgi" in httpd.conf.

Is CGI API in-built in a web server for use ?

It depends on the server you're running. Apache implements CGI as an external module, mod_cgi. Other servers build it into the core feature set.

What do you mean by "CGI specifies how a webserver can pass data to arbitrary programs" ? what is meant by "arbitrary programs" ?

"Arbitrary" just means that it can be anything. CGI can be used by a web server to pass data to any program you choose without the server having to know anything special about the program that will be receiving the data.


In reply to Re^3: CGI program by dsheroh
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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.