in reply to Checking if a header has been printed
CGI has a flag that causes subsequent calls to header to be silently ignored.
$CGI::HEADERS_ONCE = 1;
However, it's only documented in the source, not in the pod. The alternative would be to make your own flag.
if ($cgi_header_already_printed++) { warn("Attempting to send second CGI while trying to ...\n"); } else { print CGI->header(); }
|
|---|