The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

cPanel::APIClient::Transport::NetCurlPromiser

SYNOPSIS

    my $promiser = Net::Curl::Promiser::AnyEvent->new();

    my $cp = cPanel::APIClient->create(
        service => 'cpanel',
        transport => [
            'NetCurlPromiser',
            promiser => $promiser,
            hostname => 'greathosting.net',

            # For testing only:
            # tls_verification => 'off',
        ],

        credentials => {
            username => 'hugh',
            password -> 'mySecretPassword!',
        },
    );

DESCRIPTION

This module allows Net::Curl::Promiser (i.e., libcurl via Net::Curl) to serve as transport for cPanel API calls.

You can use this transport module to support any event interface that Net::Curl::Promiser itself supports. See that module’s documentation for more details.

It supports username/password or username/api_token credentials schemes. See cPanel::APIClient for more details.

It expects these parameters:

  • promiser - Required. Instance of a Net::Curl::Promiser subclass.

  • hostname - Required. The remote hostname that will serve the API calls.

  • tls_verification - Optional. Either on (default) or off.

This is probably the fastest way to call cPanel’s API via HTTP.

INTERFACE

When using this module, the immediate return from API-calling methods (e.g., call_uapi()) will be a cPanel::APIClient::Pending instance. See that module’s documentation for details of how to use it.

Cancellation

This class allows you to cancel an in-progress query, thus:

    $cp->cancel($pending, 'This is why.');

LICENSE

Copyright 2020 cPanel, L. L. C. All rights reserved. http://cpanel.net

This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.