-
-
15 Dec 2021 22:57:24 UTC
- Distribution: IO-Async
- Module version: 0.801
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (61)
- Testers (1198 / 104 / 0)
- Kwalitee
Bus factor: 1- 82.09% Coverage
- License: perl_5
- Perl: v5.8.4
- Activity
24 month- Tools
- Download (247.35KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Exporter
- File::stat
- Future
- Future::Utils
- IO::Poll
- List::Util
- Socket
- Storable
- Struct::Dumb
- Time::HiRes
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
IO::Async::Future
- use Future with IO::AsyncSYNOPSIS
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 $future->get, "\n";
DESCRIPTION
This subclass of Future stores a reference to the IO::Async::Loop instance that created it, allowing the
await
method to block until the Future is ready. These objects should not be constructed directly; instead thenew_future
method on the containing Loop should be used.For a full description on how to use Futures, see the Future documentation.
CONSTRUCTORS
New
IO::Async::Future
objects should be constructed by using the following methods on theLoop
. For more detail see the IO::Async::Loop documentation.$future = $loop->new_future
Returns a new pending Future.
$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.
done_later
$future->done_later( @result )
A shortcut to calling the
done
method in alater
idle watch on the underlying Loop object. Ensures that a returned Future object is not ready immediately, but will wait for the next IO round.Like
done
, returns$future
itself to allow easy chaining.fail_later
$future->fail_later( $exception, @details )
A shortcut to calling the
fail
method in alater
idle watch on the underlying Loop object. Ensures that a returned Future object is not ready immediately, but will wait for the next IO round.Like
fail
, returns$future
itself to allow easy chaining.AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
Module Install Instructions
To install IO::Async, copy and paste the appropriate command in to your terminal.
cpanm IO::Async
perl -MCPAN -e shell install IO::Async
For more information on module installation, please visit the detailed CPAN module installation guide.