my $w; my $cv = http_request GET => $url, ..., sub { $w = undef; callback(...) }; # kill the watcher when we're done $w = AE::timer $timeout, 0, sub { $cv = undef }; # kill the http request after $timeout seconds