NAME

Net::Curl::Promiser::Mojo - support for Mojolicious

SYNOPSIS

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();

DESCRIPTION

This module provides a Mojolicious-compatible interface for Net::Curl::Promiser.

See /examples in the distribution for a fleshed-out demonstration.

MOJOLICIOUS SPECIALTIES

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.