NAME
Hypersonic::UA::Async - Async HTTP request handling for Hypersonic::UA
SYNOPSIS
# This module is used internally by Hypersonic::UA
# Enable async support when compiling UA:
use Hypersonic::UA;
Hypersonic::UA->compile(async => 1);
DESCRIPTION
Hypersonic::UA::Async provides the async request state machine and event loop integration for Hypersonic::UA. It uses platform-native event mechanisms (kqueue on macOS/BSD, epoll on Linux) for efficient I/O multiplexing.
INTERNAL API
These methods are used internally by Hypersonic::UA.
start_request
my $slot = Hypersonic::UA::Async::start_request($method, $url, $body, $cb);
Start an async request. Returns a slot ID for tracking.
poll
my $events = Hypersonic::UA::Async::poll($slot);
Poll a single async context, return events needed.
poll_batch
my $ready = Hypersonic::UA::Async::poll_batch(@slots);
Poll multiple slots using platform-native event loop (kqueue/epoll). Returns arrayref of completed slot IDs.
get_fd
my $fd = Hypersonic::UA::Async::get_fd($slot);
Get file descriptor for async context.
get_state
my $state = Hypersonic::UA::Async::get_state($slot);
Get current state of async context:
0 = CONNECTING
1 = TLS
2 = SENDING
3 = RECEIVING
4 = DONE
5 = ERROR
6 = CANCELLED
get_result
my ($ok, $data) = Hypersonic::UA::Async::get_result($slot);
Get result from completed async context.
cancel
Hypersonic::UA::Async::cancel($slot);
Cancel an async request.
cleanup
Hypersonic::UA::Async::cleanup($slot);
Clean up completed async context and free resources.
AUTHOR
lnation <email@lnation.org>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.