> Le 10 déc. 2019 à 14:08, Sebastian Riedel <kra...@gmail.com> a écrit :
>
>>> Another big disadvantage is that it doesn't use Mojo::Promise. I don't
>>> think it will attract too many Mojo users without.
>>
>> The latest version does, actually.
>
> Ah, nice. Then you can simplify your example too.
>
> my $promiser = Net::Curl::Promiser::Mojo->new();
>
> my $handle = Net::Curl::Easy->new();
> $handle->setopt(CURLOPT_URL() => $url);
>
> $promiser->add_handle($handle)->then(
> sub { print "$url completed.$/" },
> sub { warn "$url failed: " . shift },
> )->wait;
>
> And if you really want to conform to the Mojo style you rename
> add_handle to add_handle_p, because we like to make promise
> returning methods obvious. ;)
Ah, a nice convention!
I’ll add an “add_handle_p()” alias, update the example, and make another
release.
-F
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to mojolicious+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mojolicious/EA07C296-B400-4E3D-8DA3-DD8CFF5247D1%40felipegasper.com.