Hi,

I've got a bit of an annoying issue! Our script used to work just fine - where it would print out the pages content as it was outputted from the script (using nph headers). However, for the last couple of weeks it just prints out the plain text (not HTML). To test this out, I made 2 scripts:

testing.cgi
nph-testing.cgi

Both with the same code:

#!/usr/bin/perl

$| = 1;
print "Content-Type: text/html\n
\n";

print "FOO";

for (my $i = 0; $i <= 5; $i++) {
	print "$i ... ";
	sleep 2;
}

When I run the testing.cgi script (in the browser), I correctly see this (all be it after 10 seconds, due to the "sleep" commands);

FOO0 ... 1 ... 2 ... 3 ... 4 ... 5 ... 

However, when I run nph-testing.cgi (again, in the browser), I get:

Content-Type: text/html

FOO0 ... 1 ... 2 ... 3 ... 4 ... 5 ... 

As you can see, its printing the header out - instead of telling the browser that: a) this needs to be a HTML page, and b) that it should be doing this via nph

I'm a bit baffled as to what could suddenly be causing this to occur. At first, I thought my script was outputting some content BEFORE I had printed the correct header - but this test script proves that not the case.

Anyone got any suggestions? I'm drawing a blank here (and the techs for the server are not too helpful, as they don't seem to know much about Perl)

TIA

Andy


In reply to NPH script stopped working correctly by ultranerds

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.