in reply to forking from web

I would actually create a listener program, separate from the CGI. It would open a pipe for reading (assuming your OS supports them).

The CGI would just pass along requests. (Take a look at the perlman:perlipc documentation -- you can write to and read from a pipe just as if it were a regular file.)

It's easy enough to do, but I can probably dig up some code if you like.