* perl CGI scripting running waislook
@ 1996-04-24 19:39 Lynn Blankenship
0 siblings, 0 replies; 2+ messages in thread
From: Lynn Blankenship @ 1996-04-24 19:39 UTC (permalink / raw)
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 <sanders@bsdi.com>, 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 (<HITFILE>) {
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 "<HEAD>\n<TITLE>Index of ", $title, "</TITLE>\n</HEAD>\n";
print "<BODY>\n<H2>", $title, "</H2>\n";
print "Please type a search word in the dialog box.\n<P>";
print "You may use compound searches, such as: <CODE>planning AND =
logistics</CODE>\n";
print "<ISINDEX>";
}
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 "<HEAD>\n<TITLE>Search of ", $title, "</TITLE>\n</HEAD>\n";
print "<BODY>\n<H1>", $title, "</H1>\n";
print "Index \`$waisd\' contains the following\n";
print "items relevant to \`$pquery\':<P>\n";
print "<UL>\n";
local($hits, $score, $headline, $lines, $bytes, $type, $date);
while (<WAISQ>) {
/: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 "</UL>\n";
if ($hits =3D=3D 0) {
print "Nothing found.\n";
}
print "</BODY>\n";
}
sub docdone {
if ($headline =3D~ /Search produced no result/) {
print "<HR>";
print "Search produced no results <BR>";
} else {
eval '&get_title';
print "<LI><A HREF=3D\"$hit_file\">$DocTitle</A><BR>\n";
}
$score =3D $headline =3D $lines =3D $bytes =3D $type =3D $date =3D =
'';
}
# open (STDERR,"> /dev/null");
eval '&do_wais';
^ permalink raw reply [flat|nested] 2+ messages in thread
* perl CGI scripting running waislook
@ 1996-04-24 19:39 Lynn Blankenship
0 siblings, 0 replies; 2+ messages in thread
From: Lynn Blankenship @ 1996-04-24 19:39 UTC (permalink / raw)
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 <sanders@bsdi.com>, 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 (<HITFILE>) {
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 "<HEAD>\n<TITLE>Index of ", $title, "</TITLE>\n</HEAD>\n";
print "<BODY>\n<H2>", $title, "</H2>\n";
print "Please type a search word in the dialog box.\n<P>";
print "You may use compound searches, such as: <CODE>planning AND =
logistics</CODE>\n";
print "<ISINDEX>";
}
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 "<HEAD>\n<TITLE>Search of ", $title, "</TITLE>\n</HEAD>\n";
print "<BODY>\n<H1>", $title, "</H1>\n";
print "Index \`$waisd\' contains the following\n";
print "items relevant to \`$pquery\':<P>\n";
print "<UL>\n";
local($hits, $score, $headline, $lines, $bytes, $type, $date);
while (<WAISQ>) {
/: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 "</UL>\n";
if ($hits =3D=3D 0) {
print "Nothing found.\n";
}
print "</BODY>\n";
}
sub docdone {
if ($headline =3D~ /Search produced no result/) {
print "<HR>";
print "Search produced no results <BR>";
} else {
eval '&get_title';
print "<LI><A HREF=3D\"$hit_file\">$DocTitle</A><BR>\n";
}
$score =3D $headline =3D $lines =3D $bytes =3D $type =3D $date =3D =
'';
}
# open (STDERR,"> /dev/null");
eval '&do_wais';
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1996-04-24 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-04-24 19:39 perl CGI scripting running waislook Lynn Blankenship
-- strict thread matches above, loose matches on Subject: below --
1996-04-24 19:39 Lynn Blankenship
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox