magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 1997 > 11 > Programming with Perl  

Updating Webcam Images

Sometimes, when I'm on the road a lot giving my Perl trainings at Fortune 100 companies all across the United States, I get a little homesick. Luckily, there are a few live Webcams set up that allow me to glimpse the current state of my hometown of Portland, Oregon.

One Website with live cameras is operated by the local television station, KGW. They provide eight Webcams from around Oregon and Portland (including one very close to my house), and they're updated every two or three minutes. In the past, I used to keep a browser on the instructor workstation (visible only to me) open on one of these views, and hit Reload whenever I wanted a new view.

Then I thought, Hey, why should I have to hit Reload? I've got Perl! So I crafted a CGI script that visits KGW's Web site every 30 seconds, and sends a new image whenever the picture is updated. This script is interesting because it combines three things I haven't used before in one program:

  1. Multipart server-push output.
  2. Both CGI and LWP modules.
  3. The concept of an Non-Parsed Header (NPH) script.

I've looked at #1 and #2 individually in previous columns; this month, I'll look at #3. An NPH script is different from a regular CGI script. When a regular CGI script prints to STDOUT, the HTTP server takes its output and packages it into a valid HTTP message. If the CGI script puts header information into the output stream, the server parses this and places it into the HTTP header.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2