WWW::Challonge::Tournament - A class representing a single Challonge tournament.
Version 1.01
Takes a hashref representing the tournament, the API key and the REST client and turns it into an object. This is mostly used by the module itself, to create a new tournament see "new_tournament" in WWW::Challonge.
my $t = WWW::Challonge::Tournament->new($tournament, $key, $client);
Updates specific attributes of a tournament. For a full list, see "new_tournament" in WWW::Challonge. Unlike that method, however, all of the arguments are optional.
$t->update({ name => "sample_tournament_2", type => "swiss", });
Deletes the tournament from the user's account. There is no undo, so use with care!
$t->destroy; # $t still contains the tournament, but any future operations will fail: $t->update({ name => "sample_tournament_2" }); # ERROR!
This should be invoked after a tournament's check-in window closes, but before the tournament is started. It then does the following:
Marks participants who have not checked in as inactive.
Moves inactive participants to the bottom seeds.
Transitions the tournament state from "checking_in" to "checked_in".
$t->process_check_ins;
Aborts the check-in process if the tournament's status is currently "checking_in" or "checked_in". This is useful as you cannot edit the tournament's start time during this state. It does the following:
Makes all participants active and clears their "checked_in_at" times.
Sets the tournament state from "checking_in" or "checked_in" to "pending".
$t->abort_check_in;
Starts a tournament, opening up matches for score reporting. The tournament must have at least 2 participants. If successful, sets the state of the tournament to "underway".
$t->start;
Finalises a tournament that has had all match scores submitted, rendering the results permenant. If successful, it sets the state to "complete".
$t->finalize;
Resets an "in_progress" tournament, deleting all match records. You can add, remove or edit users before starting again. Sets the state to "pending".
$t->reset;
Gets all the attributes of the tournament in a hashref. Contains the following fields.
my $attr = $t->attributes; print $attr->{name}, "\n";
Returns an arrayref of WWW::Challonge::Participant objects for every participant in the tourney.
WWW::Challonge::Participant
my $p = $t->participants; for my $participant(@{$p}) { ...
Returns a single WWW::Challonge::Participant object representing the participant with the given unique ID.
my $p = $t->participant(24279875);
Adds a new participant to the tournament, and if successful returns the newly created WWW::Challonge::Participant object. The possible arguments are as follows.
The name of the participant. Required unless challonge_username or email are provided. Must be unique within the tournament.
If the participant has a valid Challonge account, providing a name will send them an invite to join the tournament.
If the email is attached to a valid Challonge account, it will invite them to join the tournament. If not, the 'new-user-email' attribute will be set, and an email will be sent to invite the person to join Challonge.
Integer. The participant's new seed. Must be between 1 and the new number of participants. Overwriting an existing seed will bump up the other participants. If none is given, the participant will be given the lowest possible seed (the bottom).
Miscellaneous notes on a player only accessible via the API. Maximum 255 characters.
my $p = $t->new_participant({ name => "test", seed => 4 });
Returns an arrayref of WWW::Challonge::Match objects for every match in the tourney. The tournament must be in progress before this will return anything useful.
WWW::Challonge::Match
my $m = $t->matches; for my $match(@{$m}) { ...
Returns a single WWW::Challonge::Match object representing the match with the given unique ID.
my $m = $t->match(24279875);
Returns an error explaining that the current tournament has been destroyed and returns undef, used so a function doesn't attempt to operate on a tournament that has been successfully destroyed.
Checks if the passed arguments and values are valid for creating or updating a tournament.
Alex Kerr, <kirby at cpan.org>
<kirby at cpan.org>
Please report any bugs or feature requests to bug-www-challonge at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Challonge::Tournament. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-www-challonge at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WWW::Challonge::Tournament
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Challonge
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-Challonge
CPAN Ratings
http://cpanratings.perl.org/d/WWW-Challonge
Search CPAN
http://search.cpan.org/dist/WWW-Challonge
Everyone on the Challonge team for making such a great service.
Copyright 2015 Alex Kerr.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
To install WWW::Challonge, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Challonge
CPAN shell
perl -MCPAN -e shell install WWW::Challonge
For more information on module installation, please visit the detailed CPAN module installation guide.