NAME
Fetch::Loop::Hyperman - run Fetch on a Hyperman::Loop
SYNOPSIS
use Fetch;
# inside a Hyperman worker: share the worker's own loop
my $ua = Fetch->new(loop => Hyperman->loop);
my $f = $ua->get('https://upstream/api');
my $res = $f->get; # awaits without blocking the worker's other conns
DESCRIPTION
Adapts a Hyperman::Loop - the per-worker event loop at the core of Hyperman - so Fetch's client requests run on the same loop that is serving inbound connections. This is the natural pairing: a Hyperman app making outbound HTTP/2 calls with the same non-blocking machinery it serves with. Pass a raw Hyperman::Loop as Fetch->new(loop => ...) and it is wrapped automatically.
Since Fetch 0.10 (with Hyperman 0.10+) the wrapping is mostly ceremonial: Fetch drives the loop directly through Hyperman's public C ABI (resolved at runtime via Hyperman::_abi_ptr; see "C ABI" in Hyperman). Socket readiness reaches Fetch's connection state machine with no Perl call frame, interest changes skip the _ft_arm method dispatch below, and per-request deadlines are precise one-shot kernel timers armed and cancelled in C rather than entries in this adapter's 0.1s sweep list. The Perl methods in this class remain as the fallback when the running Hyperman predates its C ABI, and as the reference implementation of the adapter seam.
new([$hyperman_loop])
Wrap the given loop, or make a fresh Hyperman::Loop->new.
loop
The underlying Hyperman::Loop.
install_await
Install $Fetch::Future::AWAIT so a bare $future->get pumps the loop (run until the future readies, then stop). Because Hyperman's run is re-entrant, awaiting from inside a running worker services other connections instead of blocking them.
With Hyperman's C ABI available (0.10+), Fetch replaces this hook with a C closure at UA construction: the awaited future is bridged to a native Hyperman::Future and the loop pumped with the ABI's run_until. Besides skipping the Perl dispatch, that retires the stop flag - a nested await returns exactly when its own future readies rather than stopping whichever run happens to be innermost. This Perl version remains as the fallback.
AUTHOR
LNATION <email@lnation.org>
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION. This is free software, licensed under the Artistic License 2.0.