Net::Curl::Promiser::Mojo - support for Mojolicious
my $promiser = Net::Curl::Promiser::Mojo->new(); my $handle = Net::Curl::Easy->new(); $handle->setopt( CURLOPT_URL() => $url ); $promiser->add_handle_p($handle)->then( sub { print "$url completed.$/" }, sub { warn "$url failed: " . shift }, )->wait();
This module provides a Mojolicious-compatible interface for Net::Curl::Promiser.
See /examples in the distribution for a fleshed-out demonstration.
This module’s interface is that provided by Net::Curl::Promiser::LoopBase, with the following tweaks to make it more Mojo-friendly:
This module uses Mojo::Promise rather than Promise::ES6 as its promise implementation.
add_handle_p() is an alias for the base class’s add_handle(). This alias conforms to Mojo’s convention of postfixing _p onto the end of promise-returning functions.
add_handle_p()
add_handle()
_p
To install Net::Curl::Promiser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Curl::Promiser
CPAN shell
perl -MCPAN -e shell install Net::Curl::Promiser
For more information on module installation, please visit the detailed CPAN module installation guide.