Home arrow Reviews arrow Page 3 - New Technologies and What They Mean To You: Part 3
REVIEWS

New Technologies and What They Mean To You: Part 3


In part 2 of this series Jeremy talked about PHP, ASP and ColdFusion. In this article he explains what JSP and CGI are, providing advantages, disadvantages and examples for each.

Author Info:
By: Jeremy Wright
Rating: 4 stars4 stars4 stars4 stars4 stars / 5
February 04, 2003
TABLE OF CONTENTS:
  1. · New Technologies and What They Mean To You: Part 3
  2. · JSP
  3. · CGI
  4. · Conclusion

print this article
SEARCH DEVARTICLES

New Technologies and What They Mean To You: Part 3 - CGI
(Page 3 of 4 )

Definition

CGI stands for Common Gateway Interface and is a standard for running external programs from a Webserver. CGI specifies how to pass arguments to the executing program as part of the HTTP request. It also defines a set of environment variables. Normally each program is created in order to dynamically generate HTML which will be passed back to the browser, but it can also do a variety of server-side tasks such as redirects, reading/writing to text files, etc.

In order to improve performance, Netscape devised NSAPI and Microsoft developed the ISAPI standard, which allows CGI-like tasks to run as part of the main server process, thus avoiding the overhead of creating a new process to handle each CGI invocation.

What It Really Is

CGI is, more than anything, a framework. It isn’t a language at all. In fact, languages are written for use within CGI (save as CGI extensions, and are run by the CGI interpreter on the server). The most common language for use is Perl (others include C/C++, Fortran, TCL, Visual Basic, AppleScript), which we’ll cover later in this article.

CGI was developed for Unix systems in the 1980s and is still only on version 1.1. This, unlike other software, is in fact a good thing. It was designed with a specific goal in mind, and that goal hasn’t changed.

CGI is in fact extremely powerful in that it can be both compiled (when written using languages like C++) or interpreted (using languages like Perl and TCL).

More often than not, CGI scripts and applications are written in Perl. In fact, the use of Perl is so commonplace, as the language for writing CGI scripts, that most people think they are one and the same.

Advantages
  • Can be written in a multitude of languages
  • Fast and efficient
  • Powerful and robust
  • Compiled or interpreted, as appropriate
  • Cross platform
Disadvantages
  • Steeper learning curve than newer technologies
  • Less and less resources, the more “old school” it becomes
  • Can run slower than newer technologies
Examples

For many, many examples of CGI usage, as well as the full manual, go to http://hoohoo.ncsa.uiuc.edu/cgi/.

Here are some standard types of things you might find.

Displaying Date & Time:

($theday, $themonth, $thedate, $thetime, $thezone, $theyear) = split(' ', `date`);
print "It's $thetime $thezone on $theday $themonth $thedate, $theyear.";


Showing a Random Word:

@words_list = ('Hammer', 'in', 'those', 'screws.');
$random_word = $words_list[rand(@words_list)];
print "<CENTER>$random_word</CENTER>";


Similar Technologies

CGI has similar technologies on 2 fronts. There are other “container technologies”, and there are also other Unix-based cross-platform technologies.

  • PHP: Like CGI, PHP is cross-platform. PHP is a very strong language with an incredibly large and supportive community.
  • ASP: ASP is similar to CGI in that it is also a “container technology”. ASP pages can be written in several languages including VBScript and JScript (the server-side version of JavaScript).
Links

There are many sites out there dedicated to CGI, lots of great resources, and we’ve gathered some of the best ones here:

CGI @ NCSA
http://hoohoo.ncsa.uiuc.edu/cgi/

PerlMasters
http://www.perlmasters.com/

WebReference.com – CGI
http://www.webreference.com/programming/cgi.html

Matt’s Script Archive
http://worldwidemart.com/scripts/

WebDeveloper.com – Perl/CGI
http://www.webdeveloper.com/cgi-perl/

W3.org
http://www.w3.org/CGI/
blog comments powered by Disqus
REVIEWS ARTICLES

- Music Streaming: ReverbNation.com
- Safari Books Online Review
- Super Styling with a Dedicated CSS Editor
- Book Review: Ground-Up Java by Philip Heller
- Book Review: Winning E-Brand Strategies: Dev...
- New Technologies and What They Mean To You: ...
- Review: Namo WebEditor 5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials