読者です 読者をやめる 読者になる 読者になる

Asynchronous http call by HTTP::Tinyish

Perl6 HTTP::Tinyish now can be called asynchronous way.

github.com

my $http = HTTP::Tinyish.new(:async);

my @url = <
  http://perl6.org/
  https://doc.perl6.org/
  http://design.perl6.org/
>;

my @promise = @url.map: -> $url {
  $http.get($url).then: -> $promise {
    my %res = $promise.result;
    say "Done %res<status> %res<url>";
    %res;
  };
};

my @res = await @promise;

HTTP::Tinyish is just a wrapper for curl.

I hope we have a stable http client written in pure Perl6, which supports asynchronous http calls.