in reply to AnyEvent tcp_server not working
The problem is that the my $handle variable is private to the callback sub, and is not referenced anywhere else. So when that sub returns (immediately after push_writing your "Hello" message), it will be destroyed, and with it, your connection.
A solution is including a reference to it in one of AE::Handle's callbacks, e.g.:
on_error => sub { my ($hdl, $fatal, $msg) = @_; AE::log error => $msg; $hdl->destroy(); undef $handle; # <------ },
This way, the callback sub closes over the variable, so its reference count will be nonzero when the sub returns and thus your connection will stay alive.
In Section
Seekers of Perl Wisdom