As usual, I come to speak for threads ;-), so if you are using Perl 5.8, go threads.
Just to create two threads:
- One to accept connections, so the accept() won't stop ongoing chatings.
- One to polling sockets thru IO::Select, see whether you get any incoming msgs for dispatching, and dispatch them.
It might also be a good idea to have a third thread to dispatch msgs (instead of having the second thread doing both receiving and dispatching. This depends on your overall architecture, and msg format)