0

I understand its usually a header has been already sent type scenario but I'm starting to lose it. I have no idea how to sniff out where I mucked up in my code. I tried using a print sub routine that prints both to stdout and to a file. I saved the file output as an html it works. So its not an html issue. But I have no idea how to find out where the premature header is being sent.

3
Contributors
2
Replies
7
Views
2 Years
Discussion Span
Last Post by 2teez
0

If you are talking about printing out to HTML as a file and it can be opened using a browser, it may be because a browser usually tries to correct the HTML and can display (almost) correct.

The problem with premature header could be from not closing scope or incorrectly closing scope. Also, how did you print it out? Using print <<HTML or use simple print? If you use print <<HTML, you will need to escape certain character in your string (especially the @). Can't say much unless we see your reduct code...

0

But I have no idea how to find out where the premature header is being sent.

How are you printing the html header?

Check this:

use warnings;
use strict;
use CGI qw/standard/;

 my $cgi = CGI->new();

 print  $cgi->header,  # header printed
        $cgi->start_html(-title => "Perl Programming"),

    $cgi->end_html;

Of course, you need to show how you are printing in your script.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.