In my Perl/CGI web application, I sometimes need to run a long process which makes the wait for the next page interminable. So I've been disabling the buffer as below so that the page contents get sent before the long process runs.
local $| = 1;
print "Content-type: text/html\n\n";
print $output;
&background_process();
However it seems to me that the buffer has its uses and I should not be in the habit of doing this. Is there a better way to run a long process and still return html to the client quickly? Should I be forking or somesuch?