The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.

CLASS METHODS

$uri = $class->base_uri
  # => "http://www.gokgs.com/tournEntrants.jsp"
$URI = $class->build_uri( $k1 => $v1, $k2 => $v2, ... )
$URI = $class->build_uri({ $k1 => $v1, $k2 => $v2, ... })
$URI = $class->build_uri([ $k1 => $v1, $k2 => $v2, ... ])

Given key-value pairs of query parameters, constructs a URI object which consists of base_uri and the parameters.

INSTANCE METHODS

$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 the LWP::UserAgent object shared by Web::Scraper users ($Web::Scraper::UserAgent).

$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

WWW::GoKGS

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.