NAME

WWW::GoKGS::Scraper::TzList - KGS Time Zone Selector

SYNOPSIS

use WWW::GoKGS::Scraper::TzList;

my $tz_list = WWW::GoKGS::Scraper::TzList->new;

my $result = $tz_list->query( tz => 'Asia/Tokyo' );
# => {
#     current_time_zone => {
#         name => 'Asia/Tokyo',
#         display_name => 'Japan Standard Time'
#     },
#     time_zones => [
#         {
#             name => 'America/Anchorage',
#             display_name => 'Alaska Standard Time'
#         },
#         ...
#     ]
# }

DESCRIPTION

This class inherits from WWW::GoKGS::Scraper.

CLASS METHODS

$String = $class->base_uri
# => "http://www.gokgs.com/tzList.jsp"
$URI = $class->build_uri( tz => 'Asia/Tokyo' );

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

INSTANCE METHODS

$UserAgent = $tz_list->user_agent
$tz_list->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 = $tz_list->query

Returns a hash reference which contains your current time zone and a list of available time zones. The hashref is formatted as follows:

{
    current_time_zone => {
        name => 'Asia/Tokyo',
        display_name => 'Japan Standard Time'
    },
    time_zones => [
        {
            name => 'America/Anchorage',
            display_name => 'Alaska Standard Time'
        },
        ...
    ]
}
$HashRef = $tz_list->query( tz => 'Asia/Tokyo' )

Can be used to set your time zone. The time zone must be included by the list of time zones. HTTP cookies must be accepted by your user agent. All the KGS web pages are affected by the cookie setting, i.e., times for games are shown in the specified time zone. In other words, all the KGS resources will become stateful. If you dislike this behaviour, do not change the default time zone, GMT.

Returns a hash reference which contains your current time zone and a list of available time zones.

$HashRef = $tz_list->scrape( URI->new(...) )
$HashRef = $tz_list->scrape( HTTP::Response->new(...)[, $base_uri] )
$HashRef = $tz_list->scrape( $html[, $base_uri] )
$HashRef = $tz_list->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.