line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Chess::FIDE::Player; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
19857
|
use 5.008; |
|
7
|
|
|
|
|
21
|
|
4
|
7
|
|
|
7
|
|
33
|
use strict; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
155
|
|
5
|
7
|
|
|
7
|
|
33
|
use warnings FATAL => 'all'; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
336
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
33
|
use Exporter; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
244
|
|
8
|
7
|
|
|
7
|
|
33
|
use Carp; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
506
|
|
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
31
|
use base 'Exporter'; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
4438
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %FIDE_defaults = ( |
13
|
|
|
|
|
|
|
id => -1, |
14
|
|
|
|
|
|
|
name => 'Unknown', |
15
|
|
|
|
|
|
|
surname => '', |
16
|
|
|
|
|
|
|
givenname => '', |
17
|
|
|
|
|
|
|
fed => 'UNK', |
18
|
|
|
|
|
|
|
sex => '', |
19
|
|
|
|
|
|
|
tit => undef, |
20
|
|
|
|
|
|
|
wtit => undef, |
21
|
|
|
|
|
|
|
otit => undef, |
22
|
|
|
|
|
|
|
srtng => undef, |
23
|
|
|
|
|
|
|
sgm => undef, |
24
|
|
|
|
|
|
|
sk => undef, |
25
|
|
|
|
|
|
|
rrtng => undef, |
26
|
|
|
|
|
|
|
rgm => undef, |
27
|
|
|
|
|
|
|
rk => undef, |
28
|
|
|
|
|
|
|
brtng => undef, |
29
|
|
|
|
|
|
|
bgm => undef, |
30
|
|
|
|
|
|
|
bk => undef, |
31
|
|
|
|
|
|
|
bday => 0, |
32
|
|
|
|
|
|
|
flag => '', |
33
|
|
|
|
|
|
|
fidename => '', |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
our @EXPORT = qw(%FIDE_defaults); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
our $AUTOLOAD; |
39
|
|
|
|
|
|
|
our $VERSION = '1.21'; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new ($;@) { |
42
|
|
|
|
|
|
|
|
43
|
29996
|
|
|
29996
|
1
|
44295
|
my $class = shift; |
44
|
29996
|
|
|
|
|
156990
|
my %param = @_; |
45
|
|
|
|
|
|
|
|
46
|
29996
|
|
|
|
|
46853
|
my $player = {}; |
47
|
29996
|
|
|
|
|
47581
|
bless $player, $class; |
48
|
29996
|
|
|
|
|
95470
|
for (keys %param) { |
49
|
429918
|
100
|
|
|
|
750247
|
unless (exists $FIDE_defaults{$_}) { |
50
|
1
|
50
|
|
|
|
4
|
warn "$_ is not recognized as a valid field, ignoring" if $ENV{CHESS_FIDE_VERBOSE}; |
51
|
1
|
|
|
|
|
3
|
next; |
52
|
|
|
|
|
|
|
} |
53
|
429917
|
50
|
|
|
|
1081376
|
$player->{$_} = defined $param{$_} ? $param{$_} : $FIDE_defaults{$_}; |
54
|
|
|
|
|
|
|
} |
55
|
29996
|
|
|
|
|
142386
|
for (keys %FIDE_defaults) { |
56
|
629916
|
|
100
|
|
|
1833080
|
$player->{$_} ||= $FIDE_defaults{$_}; |
57
|
|
|
|
|
|
|
} |
58
|
29996
|
100
|
|
|
|
91840
|
$player->{fed} = 'UNK' if $player->{fed} eq '*'; |
59
|
29996
|
100
|
66
|
|
|
110982
|
$player->{sex} ||= $player->{flag} =~ /^w/ ? 'F' : 'M'; |
60
|
29996
|
100
|
|
|
|
54655
|
$player->{otit} =~ s/^\,// if $player->{otit}; |
61
|
29996
|
100
|
100
|
|
|
67546
|
$player->{tit} = 'i' if $player->{tit} && $player->{tit} eq 'm'; |
62
|
29996
|
100
|
100
|
|
|
63718
|
$player->{tit} = 'wi' if $player->{tit} && $player->{tit} eq 'wm'; |
63
|
|
|
|
|
|
|
$player->{tit} = uc($player->{tit}) . 'M' |
64
|
29996
|
100
|
66
|
|
|
66771
|
if $player->{tit} && $player->{tit} ne 'WH' && $player->{tit} !~ /m$/i; |
|
|
|
100
|
|
|
|
|
65
|
29996
|
|
|
|
|
45618
|
$player->{fed} = uc($player->{fed}); |
66
|
29996
|
|
|
|
|
139537
|
return $player; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub AUTOLOAD ($;$) { |
70
|
|
|
|
|
|
|
|
71
|
474054
|
|
|
474054
|
|
9713011
|
my $self = shift; |
72
|
474054
|
|
|
|
|
574839
|
my $param = shift; |
73
|
|
|
|
|
|
|
|
74
|
474054
|
|
|
|
|
635684
|
my $method = $AUTOLOAD; |
75
|
474054
|
|
|
|
|
687504
|
$method = lc $method; |
76
|
474054
|
|
|
|
|
1282197
|
my @path = split(/\:\:/, $method); |
77
|
474054
|
|
|
|
|
679497
|
$method = pop @path; |
78
|
474054
|
50
|
|
|
|
1023533
|
return if $method =~ /^destroy$/; |
79
|
474054
|
100
|
|
|
|
1013520
|
unless (exists $self->{$method}) { |
80
|
2
|
|
|
|
|
255
|
carp "No such method or property $method"; |
81
|
2
|
|
|
|
|
96
|
return undef; |
82
|
|
|
|
|
|
|
} |
83
|
474052
|
100
|
|
|
|
819449
|
$self->{$method} = $param if ($param); |
84
|
474052
|
|
|
|
|
1959266
|
$self->{$method}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |