NAME
WWW::GoKGS::Scraper::TournInfo - Information for the KGS tournament
SYNOPSIS
use WWW::GoKGS::Scraper::TournInfo;
my $tourn_info = WWW::GoKGS::Scraper::TournInfo->new;
my $result = $tourn_info->query(
id => 762,
);
# => {
# name => 'KGS Meijin Qualifier October 2012',
# description => 'Welcome to the KGS Meijin October Qualifier! ...',
# links => {
# entrants => [
# {
# sort_by => 'name',
# uri => 'http://www.gokgs.com/tournEntrants.jsp?id=762&sort=n',
# },
# ...
# ],
# rounds => [
# {
# round => '1',
# start_time => '2012-10-27T16:05Z',
# end_time => '2012-10-27T18:35Z',
# uri => 'http://www.gokgs.com/tournGames.jsp?id=762&round=1',
# },
# ...
# ]
# }
# }
DESCRIPTION
This class inherits from WWW::GoKGS::Scraper.
ATTRIBUTES
- $URI = $tourn_info->base_uri
-
Defaults to
http://www.gokgs.com/tournInfo.jsp
. This attribute is read-only. - $UserAgent = $tourn_info->user_agent
- $tourn_info->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
). - $CodeRef = $tourn_info->html_filter
- $tourn_info->html_filter( sub { my $html = shift; ... } )
-
Can be used to get or set an HTML filter. Defaults to an anonymous subref which just returns the given argument (
sub { $_[0] }
). The callback is called with an HTML string. The return value is used as the filtered value.$tourn_info->html_filter(sub { my $html = shift; $html =~ s/<.*?>//g; # strip HTML tags $html; });
- $CodeRef = $tourn_info->date_filter
- $tourn_info->date_filter( sub { my $date = shift; ... } )
-
Can be used to get or set a date filter. Defaults to an anonymous subref which just returns the given argument (
sub { $_[0] }
). The callback is called with a date string such as2014-05-17T19:05Z
. The return value is used as the filtered value.use Time::Piece qw/gmtime/; $tourn_info->date_filter(sub { my $date = shift; # => "2014-05-17T19:05Z" gmtime->strptime( $date, '%Y-%m-%dT%H:%MZ' ); });
METHODS
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.