internet.com

Go to WebDeveloper Home


hm-v6-139x61.gif

Database Journal: The Knowledge Center for Database Professionals

find a web host with:
CGI Access
DB Support
NT Servers
UNIX Servers
Telnet Access

advanced search
jobs

Get FREE Development Info via your Email!

The Webdeveloper channel
FlashKit
GIF.com
HiermenusCentral
webdeveloper Jobs
Java Boutique
JavaScript.com
JavaScript Source
ScriptSearch
StreamingMedia World
WDJ
WDVL
WebDeveloper.com
WebReference.com
XMLFiles.com

internet.com
Internet News
Internet Investing
Internet Technology
Windows Internet Tech.
Linux/Open Source
Web Developer
ECommerce/Marketing
ISP Resources
ASP Resources
Wireless Internet
Downloads
Internet Resources
Internet Lists
International
EarthWeb
Career Resources

Search internet.com
Advertise
Corporate Info
Newsletters
E-mail Offers

internet.commerce
Be a Commerce Partner










D R .   W E B S I T E®
WebDeveloper.com

April 19, 1999

The Place of Perl In Writing CGI Scripts; Counter-Productivity; Exit Scripts

By David Fiedler and Scott Clark
Dear Dr. Website®: I am a novice Web developer. I know Perl is the scripting language used in writing CGI, and that all CGI files must have .cgi extensions. But why do some books I've read have CGI programs ending in .pl? Second, for .pl programs, you need to compile, and this does not go through the server, right? But CGI (Perl) programs do, correct?

You have come close to answering your own question! CGI stands for Common Gateway Interface, and it's simply a way to allow programs running on a server to interact with a user working on a browser. CGI programs can be written in virtually any programming language.

Perl is frequently used not because it's mandatory, but because it's a good all-around language for this kind of work, and, being freely available, it will run on almost any server. The file extension for Perl is .pl, so if a CGI program is written in Perl, either that or .cgi will work.

However, do note that Perl is actually not generally compiled at all, but interpreted, which means changes that happen to Perl programs immediately take effect. There are Perl compilers available, however.

Please visit the CGI pages at http://webdeveloper.com/categories/cgi-perl/index.html and http://wdvl.com/Authoring/CGI/ for more information on CGI programming, as well as our own FAQ page.

Dear Dr. Website®: How can I implement a counter into a Web page without using one of those so-called free ones, and where do I store the code within the Web site folder?

You can download a counter script from many sites, such as our own ScriptSearch.com. You will have to configure the script for your particular Web server, and you will need CGI-BIN access. The script will be run from within your site's CGI-BIN directory.

Do keep in mind that in general, counters are, well, counter-productive. Nobody really cares how many hits your site gets; just look at any of the top sites on the Web -- none of them use counters. Counters are a reminder of what the Web was made up of five years ago.

Dear Dr. Website®: How do you make a new automatically launched window that goes to a URL if the user exits from our site?

Although I would encourage you to use this script sparingly -- as it can be an annoyance for your visitors -- you can achieve this effect by using the onUnload event:

<SCRIPT LANGUAGE="JavaScript">
<!--//
function openit(sURL){
newwindow=open(sURL,"newwin","width=300,height=300");
}
//-->
</SCRIPT>
</head>

<body onUnload="javascript:openit
('smallwin.html')" >

this is some random text

</BODY>

By using the onUnload event, you substitute the name of the page you wish to appear in the openit function instead of "smallwin.html." You can also change the height and width settings, or add or remove other window settings, such as whether scrollbars, toolbars, etc. appear on the window by adding their parameters to the open function, i.e.:

<SCRIPT LANGUAGE="JavaScript">
<!--//
function openit(sURL){
newwindow=open(sURL,"newwin","scrollbars=no,toolbar=no,
directories=no,menubar=no,
resizable=no,status=no, width=300,height=300");
}
//-->
</SCRIPT>
</head>

<body onUnload="javascript:openit
('smallwin.html')">

this is some random text

</BODY>


Visit The Dr. Website® Archives.
Click here for a list of Dr. Website's most frequently asked questions (and answers!).
Send your own question to Dr. Website®.

Fast Jump to Anywhere on WebDeveloper.com®:


Contact the WebDeveloper.com® staff

Last modified: 20

 

Refresh Daily
Join Editor-in-Chief David Fiedler The Editor With No Time and find truth, justice, and a clue or two.


Browse by Category
[ Site Map ]

ActiveX / VBscript
Animated GIF Archive
Browsers
CGI / Perl
Database Connectivity
E-Commerce
HTML-Advanced: DHTML, CSS
HTML / Site Authoring Tools
Intranet/Groupware
Java
JavaScript
Multimedia: Audio / Video / Streaming Technologies
Opinions
Refresh Daily: Editorial Column
Security
Servers & Server Tools
Site Design / Graphics
Site Management / Marketing / Log File Analysis
VRML / 3D
XML