in reply to multiple socket streams

Take a look at IO::Select, a wrapper for four arg select. That will let you read whichever source has data ready.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: multiple socket streams
by Forsaken (Friar) on Jun 07, 2004 at 04:23 UTC
    looks like a pretty OO version of the little stream-management thingy I built myself, but the problem persists. It's not so much a matter of knowing where there's data, as it is to determine when there's no more data left, and hence break away from this stream and move on the next. Using a timed event might do the trick as was suggested earlier, but that's not really what i would call an elegant solution.
      but that's not really what i would call an elegant solution.

      Yes, it sucked :-)

      What about doing a shift in the socket, matching what's returned against alphanum, and if nothing, move out of the sub ?

        nah, it seems i was once again suffering from severe foot-in-mouth syndrome, and zaxo was indeed right on the money suggesting IO::Select. What the problem basically comes down to is using <> on a filehandle that has no data waiting, resulting in the script freezing until some data comes along. IO::Select's ability to tell you in advance if there is data allows me to avoid that issue, hence fixing my problem.

        Great thanks to all of those who replied, Zaxo in particular :-)