NAME

API::Plesk::Response - Class for processing server answers with errors handling.

SYNOPSIS

my $res = API::Plesk::Response->new(
    operator => 'customer',
    operation => 'get',
    response => 'xml answer from plesk api',
);

$res->is_success;
$res->is_connection_error;

# get errors
$res->error_code;
$res->error_codes->[0];
$res->error_text;
$res->error_texts->[0];
$res->error;
$res->errors->[0];

# get data sections
$res->data->[0];

# get result sections
$res->results->[0];

# get id and guid
$res->id;
$res->guid;

DESCRIPTION

This class is intended for convenient processing results of Plesk API responses. Every operation of API::Plesk::Component return object of this class. And it get you easy way to manipulate with response from Plesk API.

METHODS

new(%attributes)

Create response object.

is_success()

Returns true if all results have no errors.

is_connection_error()

Returns true if connection error happened.

data()
$response->data;
$response->data->[0];
results()
$response->results;
$response->results->[0];
error_code()
$response->error_code;
error_codes()
$response->error_codes->[0];
error_text()
$response->error_text;
error_texts()
$response->error_texts->[0];
error()
$response->error;
errors()
$response->errors->[0];

AUTHOR

Ivan Sokolov <lt>ivsokolov@cpan.org<gt>