Date: Thu, 12 Jul 2001 15:38:23 -0500 (CDT) From: Mark Jacobson To: 810-088-05@uni.edu Subject: New FAQ page addition... Hi 088 students, Subtle error when using CGI standard modules and print header can occur! ------------ I have added this to the FAQ (Perl frequently asked questions or frequently accessed quandaries) page as entry or question or quandary #29. See the URL: http://www.cns.uni.edu/~jacobson/022/PERLfaq.txt ------------------------------------------------------------------------------ 29. Posted: July 12th, 2001 Thursday Very subtle error when using CGI gw(:standard) functions.... #!/usr/bin/perl -w use CGI ':standard'; print header, print start_html, h1("Hello World"), end_html; Here is the command line output of the above Perl script. chaos:~/web/cgi-bin$ perl slimer.cgi (offline mode: enter name=value pairs on standard input) chaos:~/web/cgi-bin$ perl slimer.cgi (offline mode: enter name=value pairs on standard input) Untitled Document

Hello World

Content-Type: text/html ********** Notice where Content-Type: text/html is???? !!!! ******* ----------------------- How do you correct the above program? The problem is the comma instead of the semicolon #!/usr/bin/perl -w after print header, ------------ use CGI ':standard'; print header, start_html, # REMOVE THE print from this 2nd line h1("Hello World"), end_html; OOOO RRRR O O R R print header: O O RRRR # add a semicolon ; print start_html, O O RR after print header; h1("Hello World"), O O R R and remove the comma! end_html; OOOO R R Here is what the output looks like AFTER either above correction: ----- chaos:~/web/cgi-bin$ perl slimer.cgi (offline mode: enter name=value pairs on standard input) Content-Type: text/html <------ THIS IS MORE LIKE IT!!!!!! Untitled Document

Hello World

The Content-Type: text/html line MUST BE FIRST THING the client browser ------------------- receives!!! Content-Type: text/html Content-Type: text/html WAS NOT FIRST when print header, print start_html, Mark