in reply to Waiting for an event

The usual answer for this is to use select(), probably via IO::Select (since it's easier and OO). select() will let you wait until something of interest happens on zero or more file handles (including sockets and regular files), or until a timeout. The "something of interest" includes a handle being able to read, write, or having an exceptional condition.

If you want to see an entire framework built around select (more or less), look at POE.