WWW::Kickstarter::HttpClient - HTTP client connector for WWW::Kickstarter
use WWW::Kickstarter; my $ks = WWW::Kickstarter->new( http_client_class => 'WWW::Kickstarter::HttpClient::Lwp', # default ... );
This module documents the interface that must be provided by HTTP clients to be used by WWW::Kickstarter.
my $http_client = $http_client_class->new(%opts);
The constructor. An WWW::Kickstarter::Error object is thrown on error.
Options:
agent => "application_name/version "
The string to pass to Kickstarter in the User-Agent HTTP header. If the string ends with a space, the name and version of this library will be appended, as will the name of version of the underling HTTP client.
my ( $status_code, $status_line, $content_type, $content_encoding, $content ) = $http_client->request($method, $url, $req_content);
Performs an HTTP request for the URL specified by $url using the method specified by $method (either GET or POST). For POST requests, $req_content will contain the content (of type application/x-www-form-urlencoded) to send in the request.
$url
$method
GET
POST
$req_content
application/x-www-form-urlencoded
An Accept header with value application/json; charset=utf-8 must be provided.
Accept
application/json; charset=utf-8
The following are returned: The HTTP status code received from the server ($status), the status line including the HTTP status code ($status_line), the type of the content of the response ($content_type), the character encoding of the content ($content_encoding), and the content of the response ($content).
$status
$status_line
$content_type
$content_encoding
$content
If a communication failure occurs, appropriate values for $status and $status_line should be mocked up, such as 599 and 599 Can't connect to api.kickstarter.com.
599
599 Can't connect to api.kickstarter.com
The value returned for $content_type must be in lower-case letters and devoid of parameters. undef can be returned for $content_type, and it need not be lower-case. For example, $content_type will be text/html and $content_encoding can be UTF-8 for Text/HTML; charset=UTF-8.
undef
text/html
UTF-8
Text/HTML; charset=UTF-8
See WWW::Kickstarter
To install WWW::Kickstarter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Kickstarter
CPAN shell
perl -MCPAN -e shell install WWW::Kickstarter
For more information on module installation, please visit the detailed CPAN module installation guide.