O'Reilly logo

Programming Web Graphics with Perl and GNU Softwar by Shawn Wallace

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Web Page Access Counter

There are a number of qualities that every good web access counter should have. The counter should be:

  • Simple : Why make a complicated web counter?

  • Object-oriented: Everything else is object-oriented these days, why not a counter? (Actually, the counter itself won’t be object-oriented because it doesn’t have to be, but it will use the Broken Image object to display error messages.)

  • Interpreted: We’ll be using Perl, so this shouldn’t be a problem.

  • Robust: It would be nice if the counter had the ability to use different sizes and styles of images for the numbers.

  • Secure: You don’t want other people using your counter on their web page (without your permission).

  • Portable: It shouldn’t be tied to a proprietary web server configuration.

  • High-performance: The counter’s going to be run every time someone hits your page, so it had better be fast.

Sorry, I got my notes mixed up; those are actually the buzzwords for Java, not for web counters. Well, we’ll try to take as many into account as we can anyway. Oh, and if you think you need a counter on your web page, fine, do it. Don’t let other people boss you around, although diehard bandwidth conservationists may make fun of you.

Requirements

The CGI module
The GD module
The BrokenImage module (described earlier)

Solution

The counter will use the GD module described in Chapter 4 to create the image of the numbers. It will actually just pull in precreated GIF images for each of the digits in the number and merge them into ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required