liming zhao wrote:
> hey, my cgi in perl have some problems. I need help so much .
> 
> Thanks in advance.
> 
> 
>   CGI Error
> 
> The specified CGI application misbehaved by not returning a complete set 
> of HTTP headers. The headers it did return are:
> 
> Bareword found where operator expected at C:\website\cgi-shl\guest-book.cgi line 29, 
>near ""Email:< pre> <http://127.0.0.1/cgi-shl/mailto>
> 
> ===========================================================
> 
> I runs activeperl on winXP pro with IIS 5.0.
> 
> the form is as following:
> 
> <html>
> <title>guest-book.html</title>
> <h1>forum</h1>
> <form method="post" action="/cgi-shl/guest-book.cgi">
> <p>name?<input name="name" size="20">
> <p>email:<input name="email" size="30">
> <p>suggestion?<textarea name="suggest" cols=30 rows=4></textarea>
> </textarea><p>
> <input type="submit" value="submit">
> <input type="reset" value="cancel">
> </form></html>
> 
> <form method="post" action="/cgi-shl/guest-book.cgi">
> 
> ======================================================
> 
> the following is the cgi written in perl.
> 
> #! perl
> 
> print"Content-type:text/html\n\n";
> read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
> @pairs=split(/&/,$buffer);
> foreach $pair(@pairs){
> ($name,$value)=split(/=/,$pair);
> $value=~tr/+//;
> $value=~s/%([a-f A-F 0-9][a-f A-F 0-9])/pack("C",hex($1))/eg;
> $FORM{$name}=$value;
> }
> print"<title>forum</title>";
> print"<h1>forum</h1>";
> 
> foreach $check(values%FORM){
> if($check eq""){
> print"<hr size=3>";
> print"<h2>forum";
> exit(0);
> }
> }
> 
> $FORM{'suggest'}=~s/cM\n/<br>\n/g;
> 
> $filename="c:/website/htdocs/book.html";
> 
> open(FILE,">> $filename");
> print FILE "???$FORM{'name'}<br>\n";
> print FILE "Email:<a href="mailto:$FORM{'email'}> 
> $FORM{'email'}</a><br>\n"}";

You have quotes embedded in quotes.  Either escape the inner quotes (\") or
replace the outer quotes with something like:

        print FILE qq!Email:<a href="mailto:$FORM{'email'}>$FORM{'email'}</a><br>\n"}!;
or
        print FILE <<EOD;
Email:<a href="mailto:$FORM{'email'}>$FORM{'email'}</a><br>
EOD
> print FILE "suggestions?$FORM{'suggest'}";
> close{FILE};
> 
> print "<h2>thanks for your suggestion</h2>";
> 
> print"<a href=\"book.html\">please observe the forum</a>";
> 
> 
> exit(0);

-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=162126130
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to