PX::API::Response - A Peekshows Web Services API response.
use PX::API; my $px = PX::API->new({ api_key => '13243432434', #Your api key secret => 's33cr3tttt', #Your api secret }); my $response = $px->call('px.test.echo',{ arg1 => 'val1', arg2 => 'val2', });
A response object from the Peekshows Web Services API. PX::API::Response is a subclass of HTTP::Response allowing for access to any response parameters. Module::Pluggable::Object is used to allow an extensible 'plugin' style method for loading response modules.
PX::API::Response
Module::Pluggable::Object
Along with the response parameters available from HTTP::Response, the following parameters are added for API responses.
HTTP::Response
success
Set to a 1 or 0 to signify response success or error respectively.
response
The actual content of the response returned from the API call.
err_code
The error code returned from the API call, if an error occurred.
err_string
A description of the error returned from the API call, if an error occurred.
A response plugin is simply a module that transforms the API response format into a usable perl object. Obviously this is not always necessary and the original structure is always available via $response-{_content}>.
$response-
Response plugins are required to have to following methods available via its public api:
format()
The format() method is used by PX::API::Response to match a plugin with the format argument sent to the Peekshows API. This method simply needs to return the name of the plugin format. ie: 'rest', 'json'
parse($content)
The parse() method is called upon completion of an API call and is passed the _content returned from the call. This method need only return the perl object which was created from parsing the content.
parse()
_content
HTTP::Response Module::Pluggable
PX::API http://www.peekshows.com http://services.peekshows.com
Anthony Decena <anthony@1bci.com>
<anthony@1bci.com>
Copyright (c) 2007, Anthony Decena <anthony@1bci.com>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install PX::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PX::API
CPAN shell
perl -MCPAN -e shell install PX::API
For more information on module installation, please visit the detailed CPAN module installation guide.