NAME
API::CPanel - interface to the CPanel Hosting Panel API ( http://cpanel.net )
SYNOPSIS
use API::CPanel;
my $connection_params = {
auth_user => 'username',
auth_passwd => 'qwerty',
host => '11.22.33.44',
};
### Get all panel IP
my $ip_list = API::CPanel::ip::list( $connection_params );
unless ($ip_list && ref $ip_list eq 'ARRAY' && scalar @$ip_list) {
die 'Cannot get ip list from CPanel';
}
my $ip = $ip_list->[0];
my $dname = 'perlaround.ru';
my $user_name = 'user1';
my $client_creation_result = API::CPanel::user::create( {
%{ $connection_params },
username => $user_name,
password => 'user_password',
domain => $dname,
});
# Switch off account:
my $suspend_result = API::CPanel::user::disable( {
%{ $connection_params },
user => $user_name,
} );
unless ( $suspend_result ) {
die "Cannot suspend account";
}
# Switch on account
my $resume_result = API::CPanel::user::enable( {
%{ $connection_params },
user => $user_name,
} );
unless ( $resume_result ) {
die "Cannot resumeaccount";
}
# Delete account
my $delete_result = API::CPanel::user::delete( {
%{ $connection_params },
user => $user_name,
} );
unless ( $delete_result ) {
die "Cannot delete account";
}