---
our $HTTP_CLIENT_CLASS = 'WWW::Kickstarter::HttpClient::Lwp';
our $JSON_PARSER_CLASS = 'WWW::Kickstarter::JsonParser::JsonXs';
# ---
sub _load_class {
my ($class) = @_;
# This isn't e
lass = delete($opts{http_client_class}) || $HTTP_CLIENT_CLASS;
my $json_parser_class = delete($opts{json_parser_class}) || $JSON_PARSER_CLASS;
my $agent = delete($opts{agent});
my
_load_class($http_client_class)->new( agent => _expand_agent($agent) );
$self->{json_parser } = _load_class($json_parser_class)->new();
$self->{polite } = !$impolite;
$self->{wait_until
package WWW::Kickstarter::JsonParser::JsonXs;
use strict;
use warnings;
no autovivification;
use JSON::XS qw( );
use WWW::Kickstarter::Error qw( my_croak );
sub new {
my ($clas
$self->{json_parser} = JSON::XS->new->utf8;
return $self;
}
sub decode { return $_[0]{json_parser}->decode($_[1]) }
1;
__END__
=head1 NAME
WWW::Kickstarter::JsonParser::JsonXs - JSON::XS co
json_parser_class => 'WWW::Kickstarter::JsonParser::JsonXs', # default
...
);
=head1 DESCRIPTION
This is the default JSON parser used by L<WWW::Kickstarter>.
It uses L<JSON::XS> t
package WWW::Kickstarter::JsonParser;
die "Place holder for documentation. Not an actual module";
__END__
=head1 NAME
WWW::Kickstarter::JsonParser - JSON parser connector for WWW::Kickstarter
=
>new(
json_parser_class => 'WWW::Kickstarter::JsonParser::JsonXs', # default
...
);
=head1 DESCRIPTION
This module documents the interface that must be provided by JSON parsers to
my $parser = $json_parser_class->new();
The constructor. An L<WWW::Kickstarter::Error> object is thrown on error.
=head1 METHODS
=head2 decode
my $data = $parser->decode($json);
Returns a d
LWP::UserAgent->new(
default_headers => HTTP::Headers->new(
Accept => 'application/json; charset=utf-8',
),
env_proxy => 1,
);
$http_client->agent($agent) if $agent;
n/x-www-form-urlencoded>) to send in the request.
An C<Accept> header with value C<< application/json; charset=utf-8 >> must be provided.
The following are returned:
The HTTP status code received fr