ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/Search/search.cgi.unix
Revision: 184
Committed: 2003-07-10T17:08:06-07:00 (21 years, 11 months ago) by douglas
File size: 1007 byte(s)
Log Message:
Moved CGI content output so that server errors will occur if their is an error
starting Search; also, fixed case.

File Contents

# Content
1 #!/usr/bin/perl
2 #
3 # Douglas Thrift's Search Engine CGI Script
4 #
5 # Douglas Thrift
6 #
7
8 # Perl pragma
9 use strict;
10 use CGI qw/:standard :cgi/;
11 use File::Temp qw/ tempfile tempdir /;
12
13 my $root = "/usr/local/dtse";
14 my $data = "$root/data";
15 my $search = "$root/bin/Search";
16 my $index = "$data/*.xml";
17 my $page = param('p');
18 my $query = param('q');
19 my $header = "$data/header.html";
20 my $body = "$data/body.html";
21 my $footer = "$data/footer.html";
22 my $notfound = "$data/notfound.html";
23 my $pages = "$data/pages.html";
24
25 if ($page == 0)
26 {
27 $page = 1;
28 }
29
30 my ($temphandle, $temp) = tempfile();
31
32 open($temphandle, "> $temp") || die "$0: cannot open $temp";
33 print $temphandle "$query\n";
34 close $temphandle;
35
36 open(SEARCH, "$search $index -P $page -h $header -b $body -f $footer -n " .
37 "$notfound -p $pages <$temp |" ) || die "$0: cannot fork $!";
38
39 print "Content-Type: text/html
40
41 ";
42
43 my $line;
44 while($line = <SEARCH>)
45 {
46 chomp($line);
47 print "$line\n";
48 }
49
50 close(SEARCH) || die "$0: cannot close $search: $!";
51 unlink $temp;

Properties

Name Value
svn:executable *