This code works just fine on my platform from both the command line and my browser. Those of you who have read the CGI Programming book should recognize the code.

Anyway, here's the code:

#!/usr/bin/perl -wT
use strict;
use CGI::Carp qw(fatalsToBrowser);
use CGI;
my $q = new CGI;
#line 5#
print $q->header( "text/plain" );
print "These are the HTTP Environment variables that I got.\n\n";

foreach ($q->http ) {
 print  "$_\n";
print " ". $q->http( $_ ), "\n";
}

However, when I uploaded this to another site, it wouldn't work and here's what I got in the server log:

Too late for "-T" option at expermint.cgi line 1. Could not fire up expermint.cgi

I have several other scripts at that site that generate the same errors when I leave the -T mode on. I uploaded this script to the other site because I was certain it was not my code that was generating this error.

The tech people at that site said that they were unable to get the code to work even with the -T on off thus implying there is something wrong with the above code itself.

So I uploaded it to another site and I was able to get it work.

So then I decide to leave off the -T and got some unexpected output along with the expected output:

<Iframe ><html_code><annoying_ad.png ></html_code ></iframe>

The rest of the output was as expected.

As soon as I saw the unexpected html, I realized why I had been getting the errors with the -T on.

It so happens that my account is free and in order for me to keep the account, I have to accept ads on both my webpages and my cgi scripts. I'm certain that the ads are the reason behind my errors. There is no way my scripts could untaint that!

Now, I must admit here that I'm no computer or Perl guru and it is possible that the code itself is faulty and I want to know if there are other reasons why I keep getting this error?

However, there is no reason why all of my scripts should generate the same error - especially when one of my scripts doesn't depend on input from my web browser.

Any input would be much appreciated. Sorry for the long post.


In reply to Too late for "-T" option by Anonymous Monk

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.