NAME
OvhApi::Answer - Response to a request run with OvhApi
.
SYNOPSIS
my $Answer = $Api->get(path => '/me');
if ($Answer)
{
# Success: can fetch content and process
my $content = $Answer->content;
}
else
{
# Request failed: stop here and retrieve the error
my $error = $Answer->error;
}
DESCRIPTION
This module represents a response to a query run with OvhApi
. It is build upon a HTTP::Request
object.
CLASS METHODS
Constructor
There is only one constructor: new
.
Its parameters are:
Parameter Mandatory Default Usage
------------ ------------ ---------- --------
response Yes - An HTTP::Response object return by LWP::UserAgent
INSTANCE METHODS
content
Returns the content of the answer. This method will carp
if the answer is an error.
It takes no parameter.
error
Returns the error message of the answer, or an empty string if the answer is a success.
It takes no parameter.
isSuccess
Forwards a call to HTTP::Response::is_error
in the inner HTTP::Response
of the answer. Returns true is the request was a success, false otherwise.
It takes no parameter.
This method is used for the bool
overload.
isFailure
Helper method which returns the boolean negation of isSuccess.
It takes no parameter.
SEE ALSO
The guts of module are using: JSON
.
COPYRIGHT
Copyright (c) 2013, OVH SAS. All rights reserved.
This library is distributed under the terms of LICENSE
.