#!@PERL@ # # Douglas Thrift's Search Engine CGI Script # # Douglas Thrift # # $Id$ use strict; use CGI qw/:standard :cgi/; use File::Temp qw/ tempfile tempdir /; my $prefix = "@prefix@"; my $exec_prefix = "@exec_prefix@"; my $bindir = "@bindir@"; my $search = "$bindir/Search@EXEEXT@"; open(TEST, "< $search") || die "$0: cannot open $search"; close(TEST); my $page = param('p'); my $query = param('q'); # These can be edited to customize your configuration: my $data = "$prefix/data"; my $index = "$data/*.xml"; my $header = "$data/header.html"; my $body = "$data/body.html"; my $footer = "$data/footer.html"; my $notfound = "$data/notfound.html"; my $pages = "$data/pages.html"; # if ($page == 0) { $page = 1; } my ($temphandle, $temp) = tempfile(); open($temphandle, "> $temp") || die "$0: cannot open $temp"; print $temphandle "$query\n"; close($temphandle); open(SEARCH, "$search $index -P $page -h $header -b $body -f $footer -n " . "$notfound -p $pages <$temp |" ) || die "$0: cannot fork $!"; print "Content-Type: text/html "; my $line; while($line = ) { chomp($line); print "$line\n"; } unlink $temp; close(SEARCH) || die "$0: cannot close $search: $!";