http://habrahabr.ru/blogs/perl/69890/#habracut example on how to work with async sockets in perl using AnyEvent module