IO::As...:Future(3pm)
π IO::Async::Future β the manual page, bestie edition π
okay so this is the IO::Async::Future page from the Perl docs (section 3pm, user contributed, iykyk) β¨
πΈ NAME πΈ
IO::Async::Future β use Future with IO::Async π¦
β¨ SYNOPSIS β¨
use Future::AsyncAwait;
use IO::Async::Loop;
my $loop = IO::Async::Loop->new;
my $future = $loop->new_future;
$loop->watch_time( after => 3, code => sub { $future->done( "Done" ) } );
print await( $future ), "\n";
no cap, that's the whole vibe right there π«Ά
π DESCRIPTION π
so basically: this is a subclass of Future that keeps a lil reference to the IO::Async::Loop instance that made it π. that reference is the whole point, because it lets the await method block until the Future is ready. main character energy fr.
β οΈ but listen β you do not construct these objects directly, okay? don't do it. instead, use the new_future method on the containing Loop. periodt.
and if you want the full, complete, unhurried rundown on how to use Futures in general, go read the Future documentation. that's where the lore lives πβ¨
π§ CONSTRUCTORS π§
new IO::Async::Future objects? you build them with the following methods on the Loop π. for more detail, the IO::Async::Loop documentation is right there waiting for you, go off.
$future = $loop->new_future;
returns a brand new pending Future β (it's not ready yet, it's in its waiting era)
$future = $loop->delay_future( %args );
returns a new Future that will become done at a given time β
$future = $loop->timeout_future( %args );
returns a new Future that will become failed at a given time π
π METHODS π
loop π
$loop = $future->loop;
returns the underlying IO::Async::Loop object. that's it, that's the whole method, we love an uncomplicated icon π
done_later π
$future->done_later( @result );
a shortcut for calling the done method inside a later idle watch on the underlying Loop object. the whole point? it makes sure a returned Future object isn't ready immediately, and instead waits for the next IO round. so your future is giving "not yet, bestie" for exactly one round π₯
and like done does, it returns $future itself so you can chain everything together all cute and tidy β¨
fail_later π
$future->fail_later( $exception, @details );
a shortcut for calling the fail method inside a later idle watch on the underlying Loop object. same deal: it guarantees a returned Future object isn't ready immediately, and will instead wait for the next IO round π
and like fail does, it returns $future itself, so chaining stays easy π
π«Ά AUTHOR π«Ά
Paul Evans <leonerd@leonerd.org.uk> β thank you for your service, king π
and that's the page, bestie!! this one's perl v5.40.1, dated 2026-02-21, and it's the IO::Async::Future(3pm) manpage from the User Contributed Perl Documentation. go forth and await responsibly πβ¨π
π¦ where this page comes from
- ubuntu stonking: libio-async-perl 0.805-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms