API-PleskExpand
view release on metacpan or search on metacpan
lib/API/PleskExpand.pm view on Meta::CPAN
delete / delete_response_parse
get / get_response_parse
=head1 EXPORT
Nothing.
=head1 METHODS
=over 3
=item new(%params)
Create new class instance.
Required params:
api_version -- default: 2.2.4.1
username -- Expand user name (root as default).
password -- Expand password.
url -- full url to Expand XML RPC gate (https://ip.ad.dr.ess::8442/webgate.php').
=cut
sub new {
(undef) = shift @_;
my $self = __PACKAGE__->SUPER::new(@_);
$self->{package_name} = __PACKAGE__;
unless ($self->{api_version}) {
$self->{api_version} = '2.2.4.1';
}
return $self;
}
=item AUTOLOADed methods
All other methods are loaded by Autoload from corresponding modules.
Execute some operations (see API::PleskExpand::* modules documentation).
Example:
my $res = $expand_client->Func_Module->operation_type(%params);
# Func_Module -- module in API/PleskExpand folder
# operation_type -- sub which defined in Func_Module.
# params hash used as @_ for operation_type sub.
=back
=cut
# OVERRIDE, INSTANCE(xml_request)
sub _execute_query {
my ($self, $xml_request) = @_;
# packet version override for
my $packet_version = $self->{'api_version'};
return unless $xml_request;
my $xml_packet_struct = <<" DOC";
<?xml version="1.0" encoding="UTF-8"?>
<packet version="$packet_version">
$xml_request
</packet>
DOC
my $operator = '';
if ($xml_request =~ m/create_client/is or
$xml_request =~ m/del_client/is or
$xml_request =~ m/modify_client/is or
$xml_request =~ m/get_client/is
) {
$operator = 'exp_plesk_client';
} elsif ($xml_request =~ m/create_domain/is) {
$operator = 'exp_plesk_domain';
}
my $headers = {
':HTTP_AUTH_LOGIN' => $self->{'username'},
':HTTP_AUTH_PASSWD' => $self->{'password'},
':HTTP_AUTH_OP' => $operator
};
return $headers if $self->{'dump_headers'};
return API::Plesk::xml_http_req(
$self->{'url'},
$xml_packet_struct,
headers => $headers
);
}
1;
__END__
=head1 SEE ALSO
Plesk Expand XML RPC API http://www.parallels.com/en/products/plesk/expand/
=head1 AUTHOR
Odintsov Pavel E<lt>nrg[at]cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
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.
=cut
( run in 2.050 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )