The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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 subclass of Net::Curl::Promiser.

See /examples in the distribution, as well as the tests, for fleshed-out demonstrations.

MOJOLICIOUS SPECIALTIES

This module implements 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.