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

A Web-Search CGI

A common question in the WWW newsgroups is, How do I make my Web pages searchable? Many fancy packages are available to WAIS-index, GLIMPSE-index, or "excite" your Web server, but what if you just want to make a dozen or so scripts (say, from past Web Techniques columns) available and searchable? I encountered this problem the other day when someone asked me which one of my columns talked about flock(). I couldn't recall, so I solved the problem with a script (talk about overkill).

The idea for this script came in part from a similar script written by my associate Joseph Hall (joseph@5sigma.com) as part of our CGI-course training materials. However, Joseph's script didn't make all the matched characters bold, so I planned to add this feature with just a few lines of code. Unfortunately, in the process I discovered a bug in Perl that won't be fixed until version 5.004, so my workaround took a few more lines than I originally planned.

Walking Through

The resulting Web-search CGI program can be seen in Listing One. Line 1 starts most of the programs I write these days, enabling "taint" mode with -T to prevent outside data from unknowingly being used to my disadvantage) and -w to tell me what I've done stupidly.




  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