in reply to Timeout for connect in Anyevent::HTTP. Help, please.
Just a brief look at AnyEvent::HTTP's fine documentation indicates a timeout key. This timeout value is used (and reset) at various stages of the connection, but may suffice for you.
If not that, then you may need to get a bunch more complex, creating your own timer for on_prepare, keeping the guard object for the overall http_request, and destroying the guard if the timeout happens. I'm not going to provide an example of that only because it's probably more complex than required, so it'd be a waste of time to create it.