The classical answer is a select loop. POE is a framework to do a select loop. Basically, a select loop means, you have three (possible empty) sets of filehandles: handles you want to read from, handles you want to write to, handles you're watching for errors. Using a select call (4 arg select, for details, see the manual page), you wait until "something" happens: one or more of the handles you are waiting on comes available, or a timeout happens. So, you use one of the handles to read from your pipe (or stdin), and the other handles to read your RSS feed. Do whatever is appropriate when a handle becomes available.
Personally, for simple things, I use 4-arg select. For more complicated things, I'd use POE. (Note that POE isn't the only framework available). | [reply] |
| [reply] |