AnyEvent-Promise
view release on metacpan or search on metacpan
lib/AnyEvent/Promise.pm view on Meta::CPAN
my $redis = AnyEvent::Redis->new();
my $p = promise(sub {
$redis->get('test');
})->then(sub {
$redis->set('test', shift);
})->then(sub {
$redis->get('test');
})->then(sub {
say shift;
})->catch(sub {
say 'I failed!';
say @_;
})->fulfill;
=head1 DESCRIPTION
L<AnyEvent::Promise> allows evented interfaces to be chained, taking away some
of the redundancy of layering L<AnyEvent> condition variable callbacks.
A promise is created using L<AnyEvent::Promise::new|/new> or the exported
L</promise> helper function. These will both return a promise instance and add
the callback function as the start of the promise chain. Each call to L</then>
( run in 0.606 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )