use strict; use warnings; use HTTP::Async; use HTTP::Request; my $url = ...; my $async = HTTP::Async->new; $async->add(HTTP::Request->new(GET => $url)); while ( $async->not_empty ) { if ( my $response = $async->next_response ) { # we have a reply from server or timeout # deal with $response } else { # still waiting for a response from server, # so do something else } }