| 1 | package WWW::GoKGS::Scraper::TzList; | ||||||||||
| 2 | 15 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 15 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 15 | ▶ | use parent qw/WWW::GoKGS::Scraper/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 15 | ▶ | use WWW::GoKGS::Scraper::Declare; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 16 | ▶ | sub base_uri { 'http://www.gokgs.com/tzList.jsp' } | ||||||||
|
Subroutine
base_uri: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | sub __build_scraper { | ||||||||
|
Subroutine
__build_scraper: called CC=1 SCAR=2.6
| |||||||||||
| 10 | 1 | my $self = shift; | |||||||||
| 11 | |||||||||||
| 12 | 0 | ▶ | scraper { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 13 | process '//option', 'time_zones[]' => { | ||||||||||
| 14 | # tzdata-compatible name of time zone (maybe or maybe not) | ||||||||||
| 15 | 0 | ▶ | name => sub { $_[0]->attr('value') }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 16 | # java.util.TimeZone's getDisplayName (long version, maybe) | ||||||||||
| 17 | # obviously useless, but harmless :) | ||||||||||
| 18 | 0 | ▶ | display_name => [ 'TEXT', sub { s/ \([^\)]+\)$// } ], | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 19 | 0 | ▶ | selected => sub { $_[0]->attr('selected') } }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 20 | 1 | }; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub scrape { | ||||||||
|
Subroutine
scrape: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 24 | 0 | my ( $self, @args ) = @_; | |||||||||
| 25 | 0 | my $result = $self->SUPER::scrape( @args ); | |||||||||
| 26 | |||||||||||
| 27 | 0 | for my $time_zone ( @{$result->{time_zones}} ) { | |||||||||
| 28 | 0 | ▶ | next unless delete $time_zone->{selected}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | $result->{current_time_zone} = { %$time_zone }; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 0 | $result; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 15 | 1; | |||||||||
| 36 | |||||||||||
| 37 | __END__ | ||||||||||