#!/usr/local/bin/perl -Tw # search.cgi - a simple search cgi script # # modified by Gordon Ross (gordonr@cs.sfu.ca) (22/04/97) # original code by Brian Slesinksy (bslesins@hotwired.com) require 5.001; # use strict; use DB_File; # perl 5 lib not installed on CSSnet, AnyDBM_File.pm is though. # use AnyDBM_File; # POD stuff =head1 NAME search.cgi - search page for a Web site =head1 DESCRIPTION See my article in Webmonkey for a complete description: http://www.webmonkey.com/code/97/16/index2a.html =head1 AUTHOR Brian Slesinsky =cut # parse form data my $query = $ENV{'QUERY_STRING'}; $query =~ s/q=//; $query =~ s/%[0-9a-fA-F]{2}/ /g; my @words = ($query =~ /\w+/g); # print search form my $query_value = join(' ',@words); # my $titlestring = "Search"; if ($query eq "") { $titlestring = "Search"; } else { $titlestring = "Results for $query"; } # beginning of HTML (header and just before the for loop) print <<_HTML; Content-type: text/html\n\n
this is the somewhat experimental search engine for the e.peak
you are currently searching the 1997 spring semester.
_HTML if($query eq "") { print <<_HTML;

(only the first 50 matches are shown)"; last; } my $href = $db{$page}; print "
($linkcount items found)
