in reply to How to make an HTTP request with an equivalent of curl's --max-time?
My first thought would be to wrap the call in an eval{} block, and set an alarm(), similar to the docs for the alarm function.
Hope that helps.