in reply to The problems of multiple CGI headers
use CGI ':standard'; my @cookies = (); push @cookies, cookie() if $test; # etc... test2() ? redirect($url) : header(-cookie => \@cookies); # go on to create the page.
It seems straightforward to me to build the header list as I go, then print the content after the headers are all printed. If I don't maintain a firewall (so to speak) between the two stages of execution, it can often get very hairy very quickly!
That said, I think that it's a good idea to use an existing and well-tested framework instead of writing everything from scratch every time. Personally, I like HTML::Mason. It's a breeze compared with writing vanilla CGI scripts.
|
|---|