exec cmd problem

in my html file,
i use SSI:
<!--#exec cmd="/home/sites/site69/web/cgi-bin/readbook.new.pl?id=stanley"-->

however, I can't get this pair of $ENV{'QUERY'},

my readbook.new.pl:


use CGI;
print "Content-type: text/html\n\n";

print $qs,"\n";
($num, $value) = split(/=/, $qs);
print $value,"\n";

$| = 1; # flush stdout on each write

print "<div align=center><TABLE width=75% BORDER=0 CELLPADDING=4>\n";
open(DATA, "<$datafile");

what is wrong?
what should i make it?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

First of all, use <!--#include virtual
instead of exec cgi. It does work on cgi's, and doesn't make problems like
exec cgi does.

I use similar scheme to what you are describing, and it works well.
The code below passed parameters given to html file further to the included cgi:
In html I have:
<!--#include virtual="/cgi-bin/mp3list.cgi?${QUERY_STRING}"-->

and in cgi I do the usual:

use CGI;
$query = new CGI;
$search = $query->param('search');
$disk = $query->param('disk');
and so on. This is the right way to get parameters to a CGI. and not reinventing the wheel, like you did with parsing it by yourself.
Hope that helps. Good luck.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
By the way, what is the point of "use CGI;" if you do all the things manually?
CGI.pm has a lot of nifty features that will make your life a lot easier:
mwhuenAuthor Commented:
Thank you, it works! :)
i add use CGI; because i want to debug it in shell.
I read the CGI.pm before, and are not so familiar with it,

I would like to ask more questions here,
it works when the file is .cgi, do u think it works with .pl too? (the file content is the same)
and one question more,
if i want to use CGI,
how can i get $name=stanley?

$query = new CGI;



1. About .cgi .pl...
It depends on web server config.
If it knows that .pl extension is .pl,
then "yes", you can rename it to .pl.
If you use apache, look for the next lines in the srm.conf or httpd.conf:

# To use CGI scripts:
AddHandler cgi-script .cgi .pl

2. The example you provided assumes
that the name of the control in the html form was "id", right? Then it will work.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.