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 > 06 > Programming with Perl  

Improving Link Verification

One of the major hassles of maintaining a cool Web site is verifying that links are still valid. In my October 1996 column, I introduced hverify, a program I use to ensure the validity of outbound links. I've been tweaking the program recently, and this month I am happy to announce an updated version 2. Besides improved methods for parsing and following links, this update includes a full cross reference that shows link paths and anchor-line locations. I've found that the line number really helps in locating bad links.

Listing One presents the new, improved hverify. The first two lines turn on taint-checking, warnings, and compiler restrictions, while lines 4 through 6 pull in the LWP::UserAgent library (to allow me to fetch Web pages), the HTML::PARSEr library (to locate references), and the URI::URL library (to make relative links absolute, and vice versa).

Lines 10 through 21 define three configuration parameters that define the scope of the verification. Lines 10 and 11 give the list of top-level URLs that will be examined. Here, I've pointed the list to the top of my virtual Web server.

Parsing

Lines 12 through 16 define the subroutine PARSE, which will be repeatedly passed a URL and will return 1 if the URL should be fetched and examined for further Web links, or 0 if not.




  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