title: How to completely background a process in Perl CGI under IIS
body: <p>Thanks to some other great posts here (like <a href="https://stackoverflow.com/questions/5481986/how-do-you-start-a-background-process-in-perl">this</a> and <a href="https://stackoverflow.com/questions/45792/how-can-i-fork-a-background-processes-from-a-perl-cgi-script-on-windows">that</a>), I have several reliable methods to background a process in a Perl script.</p>
  <p>However, in my environment (IIS6 on Windows Server 2003), it doesn't seem to completely background.  Take this script:</p>
  <pre><code>use CGI::Pretty qw(:standard);
  print header;
  print start_html;
  print &quot;hi&lt;br&gt;&quot;;
  system(1,qw(sleep 10));
  print &quot;bye&quot;;
  print end_html;
  </code></pre>
  <p>The browser will stay &quot;connected&quot; for 10 seconds while the sleep process runs.  &quot;hi&quot; and &quot;bye&quot; will both be printed on the screen, but the browser seems to be waiting for something more from the server (Firefox 4's and IE6's progress bars keep moving slowly for those 10 seconds).</p>
  <p>I'd like the user (for my real app) to believe the process is fully back-grounded and be fully comfortable being able to close the webpage.  With the progress bar still moving, I'm sure they'll sit and wait for it to stop before they close it or navigate away.</p>
  <p>Just to be clear - the process appears backgrounded.  I can close the web browser.  The real background job continues to run (sometimes for up to an hour) with no issues.  I'd just like to clean this up from the UI perspective.</p>
  <p>Thanks!</p>