|
Date Published: 1999-08-01
by D. Jasmine Merced
TNS, Inc.
| Prologue: |
|
In this series of articles, we are building a knowledge base from
the ground up. Each future article will expand and build on previous articles to help you gain a working
knowledge of both CGI and PERL. |
Many people use the terms CGI and perl interchangeably. Because this is so common, most people who hear
these terms think they are synonymous. In fact, they are not. In this article, we will clear this
common misconception by describing what CGI and perl are separately, and how one works with the other.
What is CGI?
CGI, short for is a specification that lets web servers run programs and
incorporates the program’s output into text, or multimedia elements (images, sound, etc), which is sent
and displayed in the web browser.
The web server and CGI program work together to give your web site dynamic information, customizations
and interactive features.
A variety of programming tools can be used in conjunction with CGI to give your web site interactivity.
Without CGI, your web pages could not do anything but display static information*.
CGI is responsible for your web site’s guestbooks, shopping carts, feedback forms, just to
name a few of the more popular CGI programs.
CGI can be used by many programming languages, such as AppleScript (MacIntosh), UserTalk (MacIntosh),
C, C++, Perl (Practical Extraction Reporting Language), TCL (Tool Command Language), and VB (Visual Basic).
So then what is Perl?
PERL, short for Practical Extraction Reporting Language, is a robust programming language created by
Larry Wall. Perl is an interpreted programming language, meaning that the source code is in plain text
(ASCII format) and as readable as this page is (whether you understand it or not when you read it is a
different matter altogether). The program is not compiled into one or more binary files.
Perl can be used to accomplish an infinite number of tasks. You can create standalone programs on your
computer entirely written in Perl. You can write programs that run automatically on your web server that
perform maintenance functions while you are sleeping.
While Perl can create non-internet based programming, Perl is also an extremely popular programming
language among web site programmers. This is because of its comparatively short learning curve, its
flexibility and because of the wide variety of pre-made programs available online today, among many
other reasons.
They live independently, but work beautifully together
As discussed above, CGI and PERL are not synonymous, and one does not require the other in order to
perform its function. In a nutshell:
Perl is a programming language used to develop applications.
CGI allows applications to interact with/display dynamic content to web users
Though Perl is a language of choice for CGI programming, other languanges can be used.
CGI is merely a transport through which a program, such as one programmed in perl, can interact with
your web site visitors.
Why is this difference important to know?
Several reasons.
If you’re seeking programming help on the newsgroups, people are typically very sensitive about posting
your message to the correct group. CGI and Perl are different, there are different newsgroups for each,
and they’ll be sure to let you know if you posted to the wrong newsgroup.
Know what you’re getting. If someone’s selling you a CGI program, is it in perl or C, TCL or
AppleScript? Though it’s a somewhat safe bet to assume products described as a “CGI program” is programmed
in perl, you know what they say about assuming.
Next Issue: A non-programmer’s Introduction to Perl
* asp (Active Server Pages), Microsoft’s proprietary web solution, offers an alternative
to CGI. Since most of the web servers utilized globally are Unix or Linux based, they cannot use asp, so
is not discussed.
D. Jasmine Merced is the President/CEO of TNS, Inc. and the administrator of The Perl Archive. She also serves as a Director of
the World Organization of Webmasters.
|