t;
use LWP::UserAgent;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
use 5.010;
use strict;
use warnings;
sub __handle_error;
sub __json_request;
=head1 NAME
WWW::Challonge - Perl wrapp
to get some content and check the response code:
my $response = $client->get("$HOST/tournaments.json?api_key=$key");
# Check for any errors:
WWW::Challonge::__handle_error $response if($response-
->{key};
my $client = $self->{client};
# The intial request URL:
my $req = "$HOST/tournaments.json?api_key=$key";
# Loop through the options (if any) and add them on:
for my $option(keys %{$opt
s;
use WWW::Challonge;
use HTTP::Request::Common qw/POST/;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
sub __args_are_valid;
sub __is_kill;
=head1 NAME
WWW::Challonge::Match::Attachmen
keys %{$args};
my $request = POST(
"$HOST/tournaments/$url/matches/$match_id/attachments/$id.json",
"Content-Type" => 'form-data',
"Content" => [ "api_key" => $key, @params ],
);
$request->
all:
my $response = $client->delete(
"$HOST/tournaments/$url/matches/$match_id/attachments/$id.json?api_key=$key");
# Check for any errors:
WWW::Challonge::__handle_error $response if($response-
use 5.010;
use strict;
use warnings;
use WWW::Challonge;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
sub __is_kill;
sub __args_are_valid;
=head1 NAME
WWW::Challonge::Participant - A
e the PUT request:
my $response = $client->request(WWW::Challonge::__json_request(
"$HOST/tournaments/$url/participants/$id.json", "PUT", $params));
# Check for any errors:
WWW::Challonge::__han
he POST call:
my $response = $client->request(WWW::Challonge::__json_request(
"$HOST/tournaments/$url/participants/$id/check_in.json", "POST",
$params));
# Check for any errors:
WWW::Challonge
use WWW::Challonge;
use WWW::Challonge::Match::Attachment;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
sub __args_are_valid;
=head1 NAME
WWW::Challonge::Match - A class representing a
Make the PUT call:
my $response = $client->request(WWW::Challonge::__json_request(
"$HOST/tournaments/$url/matches/$id.json", "PUT", $params));
# Check for any errors:
WWW::Challonge::__han
tches/$id.json?api_key=$key");
# Check for any errors:
WWW::Challonge::__handle_error $response if($response->is_error);
# If not, save it and then return it:
$self->{match} = from_json($respons
se WWW::Challonge::Participant;
use WWW::Challonge::Match;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
sub __is_kill;
sub __args_are_valid;
=head1 NAME
WWW::Challonge::Tournament - A c
# Make the PUT request:
my $response = $client->request(WWW::Challonge::__json_request(
"$HOST/tournaments/$url.json", "PUT", $params));
# Check for any errors:
WWW::Challonge::__handle_error
hallonge::HOST;
# Make the DELETE call:
my $response = $client->delete("$HOST/tournaments/$url.json?api_key=$key");
# Check for any errors:
WWW::Challonge::__handle_error $response if($response-