CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Aaargh] Newbie question: Edit Log



Zhris
Enthusiast

Jan 6, 2011, 12:35 PM


Views: 1157
Re: [Aaargh] Newbie question

Hello,

The errors you are receiving are syntax errors. If you want them to appear in the browser as your script compiles, you should use the CGI::Carp module:


Code
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; 
print "Content-type: text/html\n\n";
warningsToBrowser(1);


There are 2 key syntax errors in your code, and your host correctly pointed out that they were due to double quotes inside a double quoted string, which need to be escaped. Check lines 31 and 46 of your code, and escape (\") every internal double quote like so:


Code
31.  	print "<style type=\"text/css\">\n"; 

46. print "Posted by: $yourname <a href=\"mailto:$email\">Return Message by Email</a><br>\n";


For reference, there is no need to use multiple print statements to print a block of HTML code. Here is how to print a block of HTML code (note you don't need to escape characters, just write HTML code as you normally would. It will end printing when it reaches the closing string (in this case HTML Code)):


Code
print <<"HTML Code"; 
<html>
<head>
<title>$title</title>
</head>
<body>
<div id="mydiv"></div>
</body>
</html>
HTML Code


Let us know if you still have problems.

Chris


(This post was edited by Zhris on Jan 6, 2011, 12:49 PM)


Edit Log:
Post edited by Zhris (Enthusiast) on Jan 6, 2011, 12:36 PM
Post edited by Zhris (Enthusiast) on Jan 6, 2011, 12:37 PM
Post edited by Zhris (Enthusiast) on Jan 6, 2011, 12:38 PM
Post edited by Zhris (Enthusiast) on Jan 6, 2011, 12:38 PM
Post edited by Zhris (Enthusiast) on Jan 6, 2011, 12:40 PM
Post edited by Zhris (Enthusiast) on Jan 6, 2011, 12:41 PM
Post edited by Zhris (Enthusiast) on Jan 6, 2011, 12:43 PM
Post edited by Zhris (Enthusiast) on Jan 6, 2011, 12:45 PM
Post edited by Zhris (Enthusiast) on Jan 6, 2011, 12:46 PM
Post edited by Zhris (Enthusiast) on Jan 6, 2011, 12:49 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives