One word: POE. POE is an excessively cool asynchronous framework that makes these sorts of things a breeze. The idea is that every thing you do with POE will be non-blocking, for example, querying a web page, talking to a db, and so forth, so you can launch as many of these as you want, without the hassles of dealing with IPC or threads. Check out some of the examples in the cookbook for sample applications that demonstrate the principle. Then see CPAN's massive collection of POE::Components.

Comment on Re: What's the best way to fetch data from multiple sources asynchronously?

I'm interested in this thread because I need to re-write something similar eventually and I want to use the best approach. I was totally sold on (well at least looking into) Thread::Queue until you posted this. Then I recalled talking to one of the POE authors on a #pike IRC channel and he'd sold me on that long ago. If I recall correctly, he was writing POE for pike — which seemed a little unnecessary since pike has call_out()s built in, but the POE features that made it cool even in pike are what made me want to check it out, even though I never did. (I'd link to it, but he either never finished, or it's not called POE in pike.)

I know there are quite a number of office POE tutorials — some written by famous perl monks IIRC — but I wish there were a really good POE tutorial here on this site. I bet it would even get tons of feedback in RFC because I bet there'd be a lot of interest in it.

You know, perhaps I'll check out both approaches and see which I enjoy the most. I love perl.