Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grinnz/future-mojo
Future::Mojo - use Future with Mojo::IOLoop
https://github.com/grinnz/future-mojo
Last synced: about 2 months ago
JSON representation
Future::Mojo - use Future with Mojo::IOLoop
- Host: GitHub
- URL: https://github.com/grinnz/future-mojo
- Owner: Grinnz
- License: other
- Created: 2015-09-28T06:11:53.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-11T04:34:17.000Z (10 months ago)
- Last Synced: 2024-10-11T21:23:37.087Z (3 months ago)
- Language: Perl
- Homepage: https://metacpan.org/pod/Future::Mojo
- Size: 59.6 KB
- Stars: 0
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.pod
- Changelog: Changes
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
=pod
=head1 NAME
Future::Mojo - use Future with Mojo::IOLoop
=head1 SYNOPSIS
use Future::Mojo;
use Mojo::IOLoop;
my $loop = Mojo::IOLoop->new;
my $future = Future::Mojo->new($loop);
$loop->timer(3 => sub { $future->done('Done') });
print $future->get, "\n";=head1 DESCRIPTION
This subclass of L stores a reference to the associated L
instance, allowing the C method to block until the Future is ready.For a full description on how to use Futures, see the L documentation.
=head1 CONSTRUCTORS
=head2 new
my $future = Future::Mojo->new;
my $future = Future::Mojo->new($loop);Returns a new Future. Uses L if no loop is specified.
=head2 new_timer
my $future = Future::Mojo->new_timer($seconds);
my $future = Future::Mojo->new_timer($loop, $seconds);Returns a new Future that will become ready after the specified delay. Uses
L if no loop is specified.=head2 new_timeout
my $future = Future::Mojo->new_timeout($seconds);
my $future = Future::Mojo->new_timeout($loop, $seconds);Returns a new Future that will fail after the specified delay. Uses
L if no loop is specified.=head1 METHODS
L inherits all methods from L and implements the
following new ones.=head2 loop
$loop = $future->loop;
Returns the underlying L object.
=head2 await
$future->await;
Runs the underlying L until the future is ready. If the event
loop is already running, an exception is thrown.=head2 done_next_tick
$future = $future->done_next_tick(@result);
A shortcut to calling the L method on the
L. Ensures that a returned Future object is not ready
immediately, but will wait for the next I/O round.=head2 fail_next_tick
$future = $future->fail_next_tick($exception, @details);
A shortcut to calling the L method on the
L. Ensures that a returned Future object is not ready
immediately, but will wait for the next I/O round.=head2 promisify
my $promise = $future->promisify;
Composed from L.
=head1 BUGS
Report any issues on the public bugtracker.
=head1 AUTHOR
Dan Book
=head1 CONTRIBUTORS
=over
=item Jose Luis Martinez (pplu)
=back
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Dan Book.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
=head1 SEE ALSO
L
=cut