NAME
WWW::GoKGS::Scraper::TournEntrants - KGS Tournament Entrants
SYNOPSIS
use WWW::GoKGS::Scraper::TournEntrants;
my $tourn_entrants = WWW::GoKGS::Scraper::TournEntrants->new;
my $result = $tourn_entrants->query(
id => 762,
sort => 's'
);
# => {
# name => 'KGS Meijin Qualifier October 2012',
# entrants => [
# {
# name => 'foo',
# rank => '5d',
# standing => 'Winner'
# },
# ...
# ],
# links => {
# entrants => [
# {
# sort_by => 'name',
# uri => '/tournEntrants.jsp?id=762&sort=n'
# },
# {
# sort_by => 'result',
# uri => '/tournEntrants.jsp?id=762&sort=s'
# }
# ],
# rounds => [
# {
# round => 1,
# start_time => '2012-10-27T16:05Z',
# end_time => '2012-10-27T18:05Z',
# uri => '/tournGames.jsp?id=762&round=1',
# },
# ...
# ]
# }
# }
DESCRIPTION
This class inherits from WWW::GoKGS::Scraper.
ATTRIBUTES
- $URI = $tourn_entrants->base_uri
-
Defaluts to
http://www.gokgs.com/tournEntrants.jsp
. This attribute is read-only. - $UserAgent = $tourn_entrants->user_agent
- $tourn_entrants->user_agent( LWP::UserAgent->new(...) )
-
Can be used to get or set an LWP::UserAgent object which is used to
GET
the requested resource. Defaults to theLWP::UserAgent
object shared by Web::Scraper users ($Web::Scraper::UserAgent
).
METHODS
- $tourn_entrants->add_filter( 'links.rounds[].start_time' => $filter )
- $tourn_entrants->add_filter( 'links.rounds[].end_time' => $filter )
-
Adds a round start/end time filter.
$filter
is called with a date string such as2014-05-17T19:05Z
.$filter
can be either a filter class name or a subref. See Web::Scraper::Filter for details.use Time::Piece qw/gmtime/; $tourn_entrants->add_filter( 'links.rounds[].start_time' => sub { my $start_time = shift; # => "2014-05-17T19:05Z" gmtime->strptime( $start_time, '%Y-%m-%dT%H:%MZ' ); } );
- $HashRef = $tourn_entrants->query( id => $tourn_id, sort => 's' )
- $HashRef = $tourn_entrants->query( id => $tourn_id, sort => 'n' )
-
Given key-value pairs of query parameters, returns a hash reference which represents the tournament entrants. The hashref is formatted as follows:
- Single or Double Elimination tournaments
-
{ name => 'KGS Meijin Qualifier October 2012', entrants => [ { name => 'foo', rank => '5d', standing => 'Winner' }, ... ], links => { ... } }
- Swiss or McMahon tournaments
-
{ name => 'June 2014 KGS bot tournament', entrants => [ { position => 1, name => 'Zen19S', rank => '-', score => 29, sos => 678.5, # Sum of Opponents' Scores sodos => 514, # Sum Of Defeated Opponents' Scores notes => 'Winner' }, ... ], links => { ... } }
- Round Robin tournaments
-
{ name => 'EGC 2011 19x19 Computer Go', entrants => [ { position => 1, name => 'pachi2', rank => '-', score => 2, notes => 'Winner' }, ... ], results => { 'pachi2' => { 'Zen19S' => '0/1', 'ManyFaces1' => '1/1', 'mogobot5' => '1/1' }, ... }, links => { ... } }
- $HashRef = $tourn_entrants->scrape( URI->new(...) )
- $HashRef = $tourn_entrants->scrape( HTTP::Response->new(...) )
- $HashRef = $tourn_entrants->scrape( $html[, $base_uri] )
- $HashRef = $tourn_entrants->scrape( \$html[, $base_uri] )
SEE ALSO
AUTHOR
Ryo Anazawa (anazawa@cpan.org)
LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.