WebService::MyGengo::Response - An response from the myGengo API
Wraps a HTTP::Response received from the API with extra functionality.
# Responses usually created for you by WebService::MyGengo::Client my $http_res = $user_agent->request( $some_request ); my $res = WebService::MyGengo::Response->new( $http_res ); # Some deserialized data structure from the API my $struct = $res->response_struct; # ref($struct) eq 'HASH'
Returns the deserialized response structure for successful API calls as a hashref.
If the API response is not a hash it will be wrapped into a hash as `{ elements => \@elements }` for consistency.
If the response was a failure, returns undef.
The API-specific error code from the Response.
If the API request was successful, returns undef.
If the API returned an error, returns the API error code.
If the HTTP::Response is_error, or no API payload is available, returns 0.
The raw HTTP response is available via `$response->_raw_response`.
The API-specific error message from the Response.
If the API request was successful, returns "OK".
If the API returned an error response, returns the API error message.
If the HTTP::Response is_error, or no API payload is available, returns the status_line from the raw response.
The original HTTP::Response object.
If the original response is_success, then also check for errors in the response payload.
Otherwise, return false.
Returns the opposite of is_success
Nathaniel Heinrichs
Copyright (c) 2011, Nathaniel Heinrichs <nheinric-at-cpan.org>. All rights reserved.
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
To install WebService::MyGengo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::MyGengo
CPAN shell
perl -MCPAN -e shell install WebService::MyGengo
For more information on module installation, please visit the detailed CPAN module installation guide.