The root of the problem is that I need to use something like select() to tell me when there is data without blocking the entire process. Some data comes in character at a time whereas others come in line at a time.
The problem is that select() doesn't play well with buffers, so I have to manage my own line discipline which uses \n as the data separator. The performance is terrible because I have to write for the worst case of the slow writers.
I tried threads, and was underwhelmed. Too much memory, and initial results were not all that much better on the CPU usage.
How does Event.pm compare with CPU utilization? Can I have it watch a filehandle that triggers when a line separator is received? I hope so, but the documentation sounds strangely familiar to a select() driving the heart of the system.
Yes, it's event-based, and "any data" is the event type. That said, it's very parsimonious of CPU time. I was able to manage 100+ clients effectively on a P3-650 (class) system.
There is no reason to go threads unless code complexity is your primary problem, at least in this case. Single context, slamming data in and out? This is the way to go.
(just a reminder...you can't select on a file--a file is always ready to read).
Bruce
--- Bruce J. McKenzie | [EMAIL PROTECTED] | DoublePup Enterprises, Inc. http://www.doublepup.com | Consulting Services for Systems Development