Is is possible to get httpd to run a second program after a
POST to a input filter?
I have a routine to run queries called "run_query". What I'm
trying to do is to call a preliminary filter routine from the FORM's
"ACTION=", say called "filter", have it massage the query string
from STDIN, and then run run_query with the massaged query.
So I tried:
#!/usr/local/bin/perl
while(<>) {
$request .= $_; #read STDIN input from POST
} #(this works fine, I can print the query)
$request =~ tr/A-Z/a-z/; #lower case it, say
$| = 1; #force buffer flush on print
#now do something like:
exec 'cat $request | run_query';
(OR)
print $request | exec run_query;
(OR)
?????
I can't get it to work. My thinking was that exec would
create the correct env variables, and then launch run_query
with $request as STDIN. But I either get 500 - Server Error,
or no output from run_query (which returns an HTML web page
when called directly).
If anyone is a UNIX/CGI expert and can get this to work,
please let me know. It doesn't have to be perl, sh, csh,
or C would all be fine.
Why not recompile run_query, you ask? Versioning problems.
This would be handy in any case, since you could alter
user input to your real retrieval program. You could have
"filter_pg13" to remove references to certain biological
functions, for instance.
Any help would be much appreciated.
Oh, and where else could I post this? Email me, don't post
it here please.
Thanks,
Fred