In general when using POE (or another event loop) you're not going to be writing a while loop like that. It's a different mindset where you've got to turn your traditional imperative thinking sort of inside out. Rather than saying "Do X, then do Y, then do Z, then exit" instead you set up handlers you want called when certain things happen (network connections are received, data comes in on a socket, a filehandle becomes readable, . . .), wire things up (in POE you'd do this (say) by making a POE::Session instance mapping with inline_states from event names to your subs), and then you start the event loop and let it take over. When something you've expressed interest happens, the event loop cals your code which does its thing and then returns control back to the event loop.
Without a bit more detail what exactly your fetch_data is doing it's going to be hard to give a more specific example how to hook things up (or if you're lucky, point you at an existing module), but there's several samples in the POE distribution which might help steer you the right way; e.g. examples/queue.perl. There's also the POE Cookbook which has a good smattering of samples as well.
Edit: wording.
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: Need help in getting started with POE
by Fletch
in thread Need help in getting started with POE
by smarthacker67
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |