NAME
WWW::Challonge::Tournament - A class representing a single Challonge tournament.
VERSION
Version 1.01
SUBROUTINES/METHODS
new
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);
update
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",
});
destroy
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!
process_check_ins
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;
abort_check_in
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;
start
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;
finalize
Finalises a tournament that has had all match scores submitted, rendering the results permenant. If successful, it sets the state to "complete".
$t->finalize;
reset
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;
attributes
Gets all the attributes of the tournament in a hashref. Contains the following fields.
- accepting_predictions
- accept_attachments
- allow_participant_match_reporting
- anonymous_voting
- category
- check_in_duration
- completed_at
- created_at
- created_by_api
- credit_capped
- description
- description_source
- full_challonge_url
- game_id
- game_name
- group_stages_enabled
- group_stages_were_started
- hide_forum
- hide_seeds
- hold_third_place_match
- id
- live_image_url
- max_predictions_per_user
- name
- notify_users_when_match_opens
- notify_users_when_the_tournament_ends
- open_signup
- participants_count
- participants_locked
- participants_swappable
- prediction_method
- predictions_opened_at
- private
- progress_meter
- pts_for_bye
- pts_for_game_tie
- pts_for_game_win
- pts_for_match_tie
- pts_for_match_win
- quick_advance
- ranked_by
- review_before_finalizing
- require_score_agreement
- rr_pts_for_game_tie
- rr_pts_for_game_win
- rr_pts_for_match_tie
- rr_pts_for_match_win
- sequential pairings
- show_rounds
- signup_cap
- sign_up_url
- start_at
- started_at
- started_checking_in_at
- state
- swiss_rounds
- subdomain
- teams
- team_convertable
- tie_breaks
- tournament_type
- updated_at
- url
my $attr = $t->attributes;
print $attr->{name}, "\n";
participants
Returns an arrayref of WWW::Challonge::Participant
objects for every participant in the tourney.
my $p = $t->participants;
for my $participant(@{$p})
{
...
participant
Returns a single WWW::Challonge::Participant
object representing the participant with the given unique ID.
my $p = $t->participant(24279875);
new_participant
Adds a new participant to the tournament, and if successful returns the newly created WWW::Challonge::Participant
object. The possible arguments are as follows.
- name
-
The name of the participant. Required unless challonge_username or email are provided. Must be unique within the tournament.
- challonge_username
-
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.
- seed
-
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).
- misc
-
Miscellaneous notes on a player only accessible via the API. Maximum 255 characters.
my $p = $t->new_participant({
name => "test",
seed => 4
});
matches
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.
my $m = $t->matches;
for my $match(@{$m})
{
...
match
Returns a single WWW::Challonge::Match
object representing the match with the given unique ID.
my $m = $t->match(24279875);
__is_kill
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.
__args_are_valid
Checks if the passed arguments and values are valid for creating or updating a tournament.
AUTHOR
Alex Kerr, <kirby at cpan.org>
BUGS
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.
SUPPORT
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)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
SEE ALSO
ACKNOWLEDGEMENTS
Everyone on the Challonge team for making such a great service.
LICENSE AND COPYRIGHT
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.