line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::GoKGS::Scraper::Filters; |
2
|
9
|
|
|
9
|
|
53
|
use strict; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
394
|
|
3
|
9
|
|
|
9
|
|
52
|
use warnings FATAL => 'all'; |
|
9
|
|
|
|
|
32
|
|
|
9
|
|
|
|
|
430
|
|
4
|
9
|
|
|
9
|
|
54
|
use Exporter qw/import/; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
6686
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
7
|
|
|
|
|
|
|
datetime |
8
|
|
|
|
|
|
|
game_result |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub datetime { |
12
|
2
|
|
|
2
|
0
|
1566
|
my $time = shift; |
13
|
2
|
|
|
|
|
22
|
my ( $mon, $mday, $year, $hour, $min, $ampm ) |
14
|
|
|
|
|
|
|
= $time =~ m{^(\d\d?)/(\d\d?)/(\d\d) (\d\d?):(\d\d) (AM|PM)$}; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
6
|
$year += 2000; |
17
|
2
|
100
|
66
|
|
|
18
|
$hour -= 12 if $ampm eq 'AM' and $hour == 12; |
18
|
2
|
50
|
66
|
|
|
12
|
$hour += 12 if $ampm eq 'PM' and $hour != 12; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
22
|
sprintf '%04d-%02d-%02dT%02d:%02d', |
21
|
|
|
|
|
|
|
$year, $mon, $mday, |
22
|
|
|
|
|
|
|
$hour, $min; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub game_result { |
26
|
0
|
|
|
0
|
0
|
|
my $result = shift; |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
return 'W+Resign' if $result eq 'W+Res.'; |
29
|
0
|
0
|
|
|
|
|
return 'B+Resign' if $result eq 'B+Res.'; |
30
|
0
|
0
|
|
|
|
|
return 'W+Forfeit' if $result eq 'W+Forf.'; |
31
|
0
|
0
|
|
|
|
|
return 'B+Forfeit' if $result eq 'B+Forf.'; |
32
|
0
|
0
|
|
|
|
|
return 'Draw' if $result eq 'Jigo'; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$result; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |