cPanel::APIClient::Transport::NetCurlPromiser
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!', }, );
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.
username
password
api_token
credentials
It expects these parameters:
promiser - Required. Instance of a Net::Curl::Promiser subclass.
promiser
hostname - Required. The remote hostname that will serve the API calls.
hostname
tls_verification - Optional. Either on (default) or off.
tls_verification
on
off
This is probably the fastest way to call cPanel’s API via HTTP.
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.
call_uapi()
This class allows you to cancel an in-progress query, thus:
$cp->cancel($pending, 'This is why.');
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.
To install cPanel::APIClient, copy and paste the appropriate command in to your terminal.
cpanm
cpanm cPanel::APIClient
CPAN shell
perl -MCPAN -e shell install cPanel::APIClient
For more information on module installation, please visit the detailed CPAN module installation guide.