Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting Content-type

Status
Not open for further replies.

gnubie

Programmer
Apr 16, 2002
103
US
Printing from a Perl CGI program to a web page requires the first printed output to be:

Code:
print "Content-type: text/html\n\n";

In some scripts there are several paths to first output and it would be helpful to detect if the Content type has already been output, so redundant Content types could be avoided. Is there a way to detect it?

Thanks,

G
 
No, not really. Unless you actually have a variable that you set when you print the Content-Type line, there's not much you can do. //Daniel
 
Like Daniel said, use a boolean and set it to true when you print it out somewhere. Then just check
Code:
if ($content_type_printed)
before printing it out again. Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top