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










Library

Network Mapping at a Glance, Part 3
Doing it visually with your own Perl script.

by Kent Cearley

Many browsers cache images in order to optimize performance. There's no straightforward way to defeat this mechanism for dynamically changing images, such as our network map. Some browsers will honor an HTTP header with an explicit Expired-date value, while others recognize a pragma: no-cache token, but in general, a reliable way to avoid having images cached is to load the page containing images from a script rather than via static HTML. As a result, our WebView application will now contain two separate scripts. The first will generate HTML for the main page and is opened with the browser, and the other will simply return the network map referenced in the <IMG> tag.

The HTML for the main page can be generated by the following webview.cgi script. Figure 2 shows how our Web page containing the network map might appear to the user.

#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print <<ENDHTML
<HEAD>
<TITLE>WebView</TITLE>
</HEAD>
<BODY>
<IMG ALIGN=right SRC=netimage.cgi>
<H1 ALIGN=center>WebView</H1>
<P ALIGN=center>Barebone Beginning...</P>
</BODY>
</HTML>
ENDHTML
The page is opened in a browser with the following type of URL:

http://www.somewhere.com/~networks/webview.cgi

The <IMG> tag in this generated HTML triggers a call to netimage.cgi. Netimage.cgi is the script that actually checks each node and displays the network map. Wrapping the <IMG> tag in the webview.cgi script ensures that the browser won't cache the page along with its associated image. Note that in Netscape you still have to turn on Auto Load Images before clicking the Reload button for this to work.

Now you're ready to write the code for the <IMG> script.

[Move on to the next part of the article]


Web Developer® Site Feedback
Web Developer®
Copyright © 2000 internet.com Corporation. All rights reserved.

http://www.internet.com/

Web Developer® Home Over a dozen topics in detail Live Chat Downloads Book and Product Reviews Threaded Discussions How-To/Articles/Links Developer Daily News Subscribe Search Corporate Information Advertise Events Publications internet.com Home