| 1 | package WWW::GoKGS::Scraper::TournLinks; | ||||||||||||||||||||||||||||||||||
| 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 Exporter qw/import/; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | 15 | ▶ | use WWW::GoKGS::Scraper::Declare; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | 15 | ▶ | use WWW::GoKGS::Scraper::Filters qw/datetime/; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||
| 8 | 15 | our @EXPORT = qw( __build_tourn_links ); | |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | sub __build_tourn_links { | ||||||||||||||||||||||||||||||||
|
Subroutine
__build_tourn_links: called CC=1 SCAR=4.6
| |||||||||||||||||||||||||||||||||||
| 11 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||
| 13 | my @start_time = ( | ||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | my $time = m/ will start at (.*)$/ && $1; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
/ will start at (.*)$/ && $1
MC/DC0%0/2
/ will start at (.*)$/ && $1
/ will start at (.*)$/
$1
Truth table0%0/3
A && B
A= / will start at (.*)$/B= $1
| |||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | $time ||= m/\(([^\-]+) -/ && $1; | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
$time ||= /\(([^\-]+) -/ && $1
/\(([^\-]+) -/ && $1
MC/DC0%0/3
$time ||= /\(([^\-]+) -/ && $1
$time
/\(([^\-]+) -/
$1
Truth table0%0/4
A ||= B && C
A= $timeB= /\(([^\-]+) -/C= $1
| |||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | $time =~ tr/\x{a0}/ / if $time; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 18 | 0 | $time; | |||||||||||||||||||||||||||||||||
| 19 | }, | ||||||||||||||||||||||||||||||||||
| 20 | 3 | \&datetime, | |||||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||
| 23 | my @end_time = ( | ||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my $time = m/- ([^)]+)\)$/ && $1; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
/- ([^)]+)\)$/ && $1
MC/DC0%0/2
/- ([^)]+)\)$/ && $1
/- ([^)]+)\)$/
$1
Truth table0%0/3
A && B
A= /- ([^)]+)\)$/B= $1
| |||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | $time =~ tr/\x{a0}/ / if $time; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 27 | 0 | $time; | |||||||||||||||||||||||||||||||||
| 28 | }, | ||||||||||||||||||||||||||||||||||
| 29 | 3 | \&datetime, | |||||||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||
| 32 | my %entrants = ( | ||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sort_by => [ 'TEXT', sub { s/^By // } ], | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||
| 34 | uri => '@href', | ||||||||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | my $round = scraper { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | process '.', 'round' => [ 'TEXT', sub { m/^Round (\d+) / && $1 } ], | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 39 | 'start_time' => [ 'TEXT', @start_time ]; | ||||||||||||||||||||||||||||||||||
| 40 | 0 | process 'a', 'end_time' => [ 'TEXT', @end_time ], | |||||||||||||||||||||||||||||||||
| 41 | 'uri' => '@href'; | ||||||||||||||||||||||||||||||||||
| 42 | 3 | }; | |||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | scraper { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 45 | 0 | process '//ul[1]//li/a', 'entrants[]' => \%entrants; | |||||||||||||||||||||||||||||||||
| 46 | 0 | process '//ul[2]//li', 'rounds[]' => $round; | |||||||||||||||||||||||||||||||||
| 47 | 3 | }; | |||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||
| 50 | 15 | 1; | |||||||||||||||||||||||||||||||||