in reply to Why is the browser displaying a content header?

using the example code you provided (modified a little adding a couple semi-colons where needed
and some text to print
it's not displaying the content header in the browser for me on a Mac using Safari or IE
#!/usr/bin/perl use CGI; use CGI::Carp qw(fatalsToBrowser set_message); $CGI::HEADERS_ONCE = 1; BEGIN { sub carp_error { my $message = shift; error( $message ); } CGI::Carp::set_message( \&carp_error ); } my $q = new CGI; # time passes print $q->header( 'text/html' ); print "test"; exit; sub error{ # die nicely exit; }

Replies are listed 'Best First'.
Re^2: Why is the browser displaying a content header?
by wfsp (Abbot) on Jul 05, 2004 at 14:34 UTC
    Hi, Try it with a
    die; # induce a fatal error
    1. Before the print header and
    2. After the print header.
    Sorry I didn't make that clear. Thanks for your trouble,
    wfsf