Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Question

Can't get CGI output to run in browser (Perl)

Dec 9, 2013 10:14PM PST

I have several scripts on my site, each of which manufactures a new web page on the fly and there's no problem with how they display. My latest attempt has failed: it outputs html code that looks good to me and will run fine if I paste it into a new .html file, but the code just sits there in my browser. I also get a confusing message from Firefox's analytics: "The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature." I've rechecked the output carefully and it says text/html everywhere so I can't figure out why it's loading as plain text. Here's the relevant code (I think):
print<<QWERTYUIOP;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE>1001 Verses</TITLE>
<META NAME="DESCRIPTION" CONTENT="1001 Verses from Arabian Nights Mardrus-Mathers translation">
<STYLE TYPE="text/css">
<!--
P { color: #000080 }
TD P { color: #000080 }
H1 { color: #000080 }
A:visited { color: #ff00ff }
-->
</STYLE>
</HEAD>

<BODY LANG="en-US" TEXT="#000080" VLINK="#ff00ff" BACKGROUND="http://theinfosite.org/image2.jpg" DIR="LTR">
<P ALIGN=CENTER><FONT SIZE=10<B>1001 Verses</B></FONT>
<P ALIGN=CENTER><FONT SIZE=5<B>$poem</B></FONT><br>
<p ALIGN=CENTER><audio SRC="http://theinfosite.org/1001/Book 16/$poem.mp3" controls autoplay>;
Your browser does not support the audio element </audio></p>
</BODY>

</HTML>
QWERTYUIOP

What am I overlooking?

Discussion is locked