I have several perl functions that are running on a web server that print the web browser. Is there a way to determine whether a web browser has already been sent the web headers? A very simple example of code that I am using follows.
The problem is that when the headers get printed twice, this appears: "Content-Type: text/html; charset=ISO-8859-1". Ideally this check would take place in the "send_headers" function. The way I am doing it now is a sloppy, sloppy hack.
sub my_func {
my($check) = @_;
if ($check eq "no") {
&send_headers;
}
#do stuff here
return();
}
sub send_headers {
my $query = CGI:new();
print $query->header;
}