#!/usr/local/bin/perl # # script to run glookbib on my reference database # hacked from p364 of Managing Internet resources book. # jpo 29-8-94 # Set automatic flushing to avoid loss of data. $| = 1; $data_file = "./the-big-one"; if ($ENV{'REQUEST_METHOD'} eq 'GET') { $query = $ENV{'QUERY_STRING'}; if ($query !~ /\w/) { &html_header("Protein Reference Database Search"); print '
'; print "

\n"; print "Welcome to a new reference search service, simply enter \n"; print "keywords (authors, date, journal, etc.) in the box \n"; print "below, and press return !"; print ""; print "

\n"; print "Creation Date: 20th October 1995\n"; print "

\n"; print '

jpo
'; &html_trailer; } else { $query =~ tr/+/ /; $query =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($query !~ /^[a-zA-Z0-9_\-+ \t\/@%]+$/) { # catch bad input &html_header("Illegal Characters"); print "The search phrase contains illegal \n"; print "characters. Please back up and resubmit \n"; print "the query.\n"; &html_trailer; } else { # send to output as preformatted stream &html_header("Reference Database Search Results"); print "

Database search performed with glookbib.

\n"; print "
\n"; print "
\n";
			#flush();
			system("echo $query | rsh siris7.sandwich.pfizer.com -l refdb ./glookbib $data_file");
			print "
\n"; print "
\n"; print "

\n"; print "The database is held in the refer format, some troff typesetting \n"; print "code are left in the output."; print '

jpo
'; &html_trailer; } } } # subroutine to write out the start of an HTML stream sub html_header { $document_title = $_[0]; print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "$document_title\n"; print "\n"; print "\n"; print "

$document_title

\n"; print "

\n"; } # subroutine to write out the end of an HTML stream sub html_trailer{ print "\n"; print "\n"; }