I use forking alot for intense SQL queries when the results of the queries doesnt matter to the user.

There are two ways to do the forking that Ive found that fixes your problem.

Method one: Fork with a location tag. Once the browsers receive the location tag they go away without waiting.

Example:

#!/usr/bin/perl # # do pre fork stuff here # if (fork) { # # Damn browser, go away! # print "Location: http://www.wherever.com/blah\n\n"; exit; } # # do post forking stuff here #

Method two: Disable buffering and then close STDOUT.

Example:

#!/usr/bin/perl # #disable buffering # $| = 1; # # prefork stuff # if (fork) { # # stuff to display to user. other processing that # the user needs to see, ect. # print "Content-type: text/html\n\n"; print "Done"; } # # Close STDOUT; # close STDOUT; # # work in the background #

Pete

insert into pete('red hair','green eyes','overinflated ego');


In reply to Re: (petethered) How do you tell the parent process to stop it's HTTP transfer, when it forks off a child process? by Anonymous Monk
in thread How do you tell the parent process to stop it's HTTP transfer, when it forks off a child process? by kleinbiker7

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.