in reply to custom CGI die

Use this descendent of CGI
package Some_CGI; use CGI; @ISA = qw(CGI); use strict; my $is_header_printed = 0; sub header { my $self = shift; return if $is_header_printed; $is_header_printed = 1; $self->SUPER::header(); } 1;
If you use this class instead of CGI, and call header in the object oriented sense, it should accomplish what you want.
... my $form = Some_CGI->new(); ... print $form->header(); ...