spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / perl / wicked_cool_perl_scripts

[next]

.Net Developer / Coder
Aquent
US-CA-Burbank

Justtechjobs.com Post A Job | Post A Resume
Developer News
iPhone Users Just Want to Have Fun
Oops! I Fixed the Linux Kernel
Jim Zemlin: The New Center of Linux Gravity

Wicked Cool Perl Scripts

Cover: Wicked Cool Perl Scripts
This chapter is excerpted from the book, Wicked Cool Perl Scripts, 2nd Edition, authored by Steve Oualline. Copyright 2006 No Starch Press, February 2006.


CGI Debugging

Perl and the Web were made for each other. The Perl language is ideal for processing text in an environment where speed does not matter. Perl can munch text and use it to produce dynamic web pages with ease.

But programming in a CGI environment is not the easiest thing in the world. There is no built-in CGI debugger. Also, error messages and other information can easily get lost or misplaced. In short, if your program is not perfect, things can get a little weird.

In this chapter, I'll show you some of the Perl hacks you can use to help debug your CGI programs.

Hello World

This is the CGI version of "Hello World." In spite of it being a very simple program, it is extremely useful. Why? Because if you can run it, you know that your server is properly configured to run CGI programs. And from bitter experience I can tell you that sometimes configuring the server is half the battle.

The Code

Running the Script

To run the script, just point your web browser at the correct URL. If you are using the default Apache configuration, the script resides in ~apache/cgi-bin/hello.pl and the URL to run it is http://server/cgi-bin/hello.pl.

The Results

The results

How It Works

The script just writes out its greeting, so the script itself is very simple.

The purpose of the script is to help you identify all the problems outside the script that can prevent CGI scripts from running.

Hacking the Script

In this section, I'm supposed to tell you how to enhance the script. But really, what can you do with "Hello World!"?

I suppose you could enhance it by saying "Hello Solar System," "Hello Galaxy," or "Hello Universe." You are limited only by your imagination.

home / programming / perl / wicked_cool_perl_scripts

[next]



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Performance Optimizations for High Speed JavaScript · Advanced Web Performance Optimization · Simple Comments Meets OpenID
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Installing Oracle E-Business Suite R12 on Windows 2003 · When the Cloud Storms on You · eBay Watch: DSR 4.3 Tips, Tactics and Seller POV

URL: