As for the "too late for -T" part - you did not invoke the perl script with 'perl -T script.pl'.

The #! line in your perl script has the -T option, but the perl interpreter was not invoked with -T in its argument list. By the time Perl discovers a -T in the script, it's too late to properly taint everything from the environment. Therefore Perl gives up with the error message.

The quick fix: just drop the -T in your perl script. You don't really need it here.

Also the line
print "Content-type: text/html";
needs to have two returns. Change it to
print "Content-type: text/html\n\n";
The two returns will insert a blank line after the Content-type, and this is required by the server. Otherwise you will get server errors.

You probably want to use HEREDOC too otherwise you will have to keep typing 'print' and quotes ... :)

I have created a demo program for you. It uses the CGI module to format a proper Content-type header, and then HEREDOC for the content of the HTML.

#!C:\Perl\bin\perl.exe -w use strict; use CGI; my $cgi = new CGI; print $cgi->header(), <<HTML <html> <head><title>wow</title></head> <body> IIS Perl Interpreter works jus fine </body> </html> HTML ;

In reply to Re: Running Perl Scripts by Roger
in thread Running Perl Scripts by Sajoe

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.