in reply to Re^2: CGI program
in thread CGI program

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.