API::Plesk - OOP interface to the Plesk XML API (http://www.parallels.com/en/products/plesk/).
use API::Plesk; use API::Plesk::Response; my $plesk_client = API::Plesk->new(%params); my $res = $plesk_client->Func_Module->operation_type(%params); if ($res->is_success) { $res->get_data; # return arr ref of answer blocks }
At present the module provides interaction with Plesk 8.3.0 (API 1.5.0.0). Complete support of operations with Accounts, partial support of work with Templates (account and domains). Support of addition of domains to user Accounts.
API::Plesk module gives the convenient interface for addition of new functions. Extensions represent modules in a folder Plesk with definitions of demanded functions. Each demanded operation is described by two functions: op and op_response_parse. The first sub generates XML query to Plesk, the second is responsible for parse XML answer and its representation in Perl Native Structures. As a template for a writing of own expansions is better to use API/Plesk/Account.pm. In module API::Plesk::Methods we can find service functions for a writing our extensions.
For example, here the set of subs in the Accounts module is those.
create / create_response_parse modify / modify_response_parse delete / delete_response_parse get / get_response_parse
Nothing.
Create new class instance.
Required params:
api_version -- default: 1.5.0.0 username -- Plesk user name. password -- Plesk password. url -- full url to Plesk XML RPC gate (https://ip.ad.dr.ess:8443/enterprise/control/agent.php).
All other methods are loaded by Autoload from corresponding modules. Execute some operations (see API::Plesk::* modules documentation).
Example:
my $res = $plesk_client->Func_Module->operation_type(%params); # Func_Module -- module in API/Plesk folder # operation_type -- sub which defined in Func_Module. # params hash used as @_ for operation_type sub.
Plesk XML RPC API http://www.parallels.com/en/products/plesk/docs/
Odintsov Pavel <nrg[at]cpan.org> Nikolay Shulyakovskiy <shulyakovskiy[at]rambler.ru>
Copyright (C) 2008 by NRG
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install API::Plesk, copy and paste the appropriate command in to your terminal.
cpanm
cpanm API::Plesk
CPAN shell
perl -MCPAN -e shell install API::Plesk
For more information on module installation, please visit the detailed CPAN module installation guide.