GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
IO::Async::Future(3) User Contributed Perl Documentation IO::Async::Future(3)

"IO::Async::Future" - use Future with IO::Async

   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";

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 the "new_future" method on the containing Loop should be used.

For a full description on how to use Futures, see the Future documentation.

New "IO::Async::Future" objects should be constructed by using the following methods on the "Loop". 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.

   $loop = $future->loop

Returns the underlying IO::Async::Loop object.

   $future->done_later( @result )

A shortcut to calling the "done" method in a "later" 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.

   $future->fail_later( $exception, @details )

A shortcut to calling the "fail" method in a "later" 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.

Paul Evans <leonerd@leonerd.org.uk>
2022-04-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.