AnyEvent-Future

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

       my $cv = Future->needs_all(
          http_get_future( "http://url-1" ),
          http_get_future( "http://url-2" ),
          http_get_future( "https://url-third/secret" ),
       )->as_cv;
    
       my @results = $cv->recv;

    In this case, the moment any of the HTTP GET functions fails, the ones
    that are still pending are all cancelled (by dropping their
    cancellation watcher object) and the overall recv call throws an
    exception.

    Of course, there is no need to convert the outermost Future into a
    CondVar; the full set of waiting semantics are implemented on these
    instances, so instead you may simply call get on it to achieve the same
    effect:

       my $f = Future->needs_all(
          http_get_future( "http://url-1" ),
          ...

lib/AnyEvent/Future.pm  view on Meta::CPAN

   my $cv = Future->needs_all(
      http_get_future( "http://url-1" ),
      http_get_future( "http://url-2" ),
      http_get_future( "https://url-third/secret" ),
   )->as_cv;

   my @results = $cv->recv;

In this case, the moment any of the HTTP GET functions fails, the ones that
are still pending are all cancelled (by dropping their cancellation watcher
object) and the overall C<recv> call throws an exception.

Of course, there is no need to convert the outermost C<Future> into a
C<CondVar>; the full set of waiting semantics are implemented on these
instances, so instead you may simply call C<get> on it to achieve the same
effect:

   my $f = Future->needs_all(
      http_get_future( "http://url-1" ),
      ...
   );



( run in 0.439 second using v1.01-cache-2.11-cpan-496ff517765 )