hello all, today i am trying to write my first CGI program. so i have a HTML page, a JavaScript program that both work just fine when i run them locally. so, the next step is to run it on an Apache server (locally on MacOSX) and the first example would be the "Hello World" that also works fine. the problem is when i am trying to display "Content-type: text/html" what i have written is :
#!/usr/bin/perl -wT use strict ; use warnings ; use diagnostics ; use CGI ; use CGI::Ajax ; print "Content-type: text/html \n\n"; sub initialize_html { my $html = <<HTML ; <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no +"/> <meta http-equiv="content-type" content="text/html; charset=UTF-8" +/> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0px; padding: 0px } label { font-size:9px; text-align:center; color:#222; text- +shadow:0 0 5px #fff; font-family:Helvetica, Arial, sans-serif; } #map_canvas { height: 100% } </style> <title>network_weathermap</title> <script type="text/javascript" src="http://maps.google.com/maps/ap +i/js?sensor=false"></script> <script type="text/javascript" src="js/network_weathermap.js"></sc +ript> </head> <body> <div id="map_canvas"></div> </body> </html> HTML print $html . "\n" ; } #initialize_html() ; sub parameterize_info_window { return "CGI \n" ; } my $cgi = new CGI() ; my $ajax = new CGI::Ajax( describeInfoWindow => \&paramete +rize_info_window) ; print $ajax->build_html($cgi, \&initialize_html) ; $ajax->JSDEBUG( 1 ) ;
and returns : "No head/html tags, nowhere to insert. Returning javascript anyway" how can i overcome this problem ? what is the cause of it ? thank you

In reply to CGI ... newbie by OneDreamCloser

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.