From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1996q2-0010.alphant@archive.invalid> X-Archive-Original-Message-ID: Date: Wed, 24 Apr 1996 14:39:40 -0500 From: Lynn Blankenship Subject: perl CGI scripting running waislook Does anyone have an example of a perl script that uses waislook? I = found one running on unix, but I have yet been unable to get it to work = on the AlphaNT using Perl 5 and my http server. The perl script runs = fine, but it doesn't fork the output of the waislook back to stdin. I = don't know perl if that gives you any indication of my predicament. Thanks for your help.=20 P.S. Below is the script if you want to see it. # search-ogr.pl # # wais.pl -- WAIS search interface # # $Id: wais.pl,v 1.2 1994/04/10 05:33:29 robm Exp $ # # Tony Sanders , Nov 1993 # # Example configuration (in local.conf): # map topdir wais.pl &do_wais($top, $path, $query, "database", = "title") # #$waisx =3D "waislook.exe"; $waisd =3D "d:\\web\\httpd\\htdocs\\sources\\ogr"; # $src =3D "d:\\web\\httpd\\htdocs\\sources\\ogr"; $title =3D "Ongoing Research Database"; # $server =3D "chakotay.au.af.mil"; sub get_title { open(HITFILE,$hit_file_full); $Found =3D 0; $DocTitle =3D ""; while () { if ($Found) { if (/\<\/P\>/) { $Found =3D 0; } else { $DocTitle .=3D " " . $_; } } if (/Title:/) { $Found =3D 1; }=20 }=20 close(HITFILE); $DocTitle =3D~ s/\n+//g; } sub send_index { print "Content-type: text/html\n\n"; =20 print "\nIndex of ", $title, "\n\n"; print "\n

", $title, "

\n"; print "Please type a search word in the dialog box.\n

"; print "You may use compound searches, such as: planning AND = logistics\n"; print ""; } sub do_wais { # local($top, $path, $query, $src, $title) =3D @_; do { &'send_index; return; } unless defined @ARGV; local(@query) =3D @ARGV; local($pquery) =3D join(" ", @query); print "Content-type: text/html\n\n"; # open(WAISQ, "-|") || exec $waisx, " -d ", $waisd, " -http ", = @query; open(WAISQ, "waislook.exe -d $waisd @query |"); print "\nSearch of ", $title, "\n\n"; print "\n

", $title, "

\n"; print "Index \`$waisd\' contains the following\n"; print "items relevant to \`$pquery\':

\n"; print "

    \n"; local($hits, $score, $headline, $lines, $bytes, $type, $date); while () { /:score\s+(\d+)/ && ($score =3D $1); /:number-of-lines\s+(\d+)/ && ($lines =3D $1); /:number-of-bytes\s+(\d+)/ && ($bytes =3D $1); /:type "(.*)"/ && ($type =3D $1); /:headline "(.*)"/ && ($headline =3D $1); # XXX /:original-local-id "\d*\s*\d*\s(\/.*)"/ &&=20 ($hit_file_full =3D $1) && ($position =3D index($1,"htdocs")) &&=20 ($hit_file =3D substr($1,$position+6)); /:date "(\d+)"/ && ($date =3D $1, $hits++, &docdone); }; close(WAISQ); print "
\n"; if ($hits =3D=3D 0) { print "Nothing found.\n"; } print "\n"; } sub docdone { if ($headline =3D~ /Search produced no result/) { print "
"; print "Search produced no results
"; } else { eval '&get_title'; print "
  • $DocTitle
    \n"; } $score =3D $headline =3D $lines =3D $bytes =3D $type =3D $date =3D = ''; } # open (STDERR,"> /dev/null"); eval '&do_wais';