chris2 has asked for the wisdom of the Perl Monks concerning the following question:

I've been given the task of writing a basic meta search engine that will query 10 search engines and return the results in formatted html. I'm using LWP::Request, and instead of having it complete them sequentially I want to fork them off and have them off so the results appear much quicker. I know this would be done in threads in C++ but I'm a novice at that and would prefer to use perl. I've tried to fork it off into 10 different parts but I can't get it to spawn only 10, I've played around with fork and the manpages for 2 days now with no avail, all that happens is it spawns process' until its out of memory and crashes. Is it even possible to use fork to mimick threading? -Chrs Miseresky TesliaNET, Inc.

Replies are listed 'Best First'.
(tye)Re: Forking to mimick threads
by tye (Sage) on Mar 07, 2001 at 03:02 UTC

    I was going to wait for someone else to answer, but you asked again in the chatterbox so I'll repeat my advice here for postperity: See LWP::Parallel and friends.

            - tye (but my friends call me "Tye")
Re: Forking to mimick threads
by gregorovius (Friar) on Mar 07, 2001 at 03:10 UTC
    You can look at this posting in which I use forking to simulate multiple parallel LWP requests and merlyn suggests using the LWP::Parallel module for the same purpose.
Re: Forking to mimick threads
by chris2 (Initiate) on Mar 07, 2001 at 11:56 UTC
    UPDATE Thanks for all your advice, you saved me another 2 days of looking around in the wrong places. Script runs fine now. -Chris Miseresky TesliaNET, Inc.
      Chris: Can you help me? Some bastard with the same name as you, apparently from the same company in Toronto, has hijacked my browser (one of my hotmail kids must have stumbled into some spurious site). Any suggestions how I can get the damn browser bar off my IE browser?
        Use another kind of web browser.