line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Chess::FIDE::Player; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
55155
|
use 5.008; |
|
7
|
|
|
|
|
25
|
|
4
|
7
|
|
|
7
|
|
35
|
use strict; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
174
|
|
5
|
7
|
|
|
7
|
|
35
|
use warnings FATAL => 'all'; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
399
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
36
|
use Exporter; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
333
|
|
8
|
7
|
|
|
7
|
|
42
|
use Carp; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
509
|
|
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
34
|
use base 'Exporter'; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
5289
|
|
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.10'; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new ($;@) { |
42
|
|
|
|
|
|
|
|
43
|
29996
|
|
|
29996
|
1
|
38608
|
my $class = shift; |
44
|
29996
|
|
|
|
|
164631
|
my %param = @_; |
45
|
|
|
|
|
|
|
|
46
|
29996
|
|
|
|
|
48416
|
my $player = {}; |
47
|
29996
|
|
|
|
|
46874
|
bless $player, $class; |
48
|
29996
|
|
|
|
|
108811
|
for (keys %param) { |
49
|
429918
|
100
|
|
|
|
774131
|
unless (exists $FIDE_defaults{$_}) { |
50
|
1
|
50
|
|
|
|
5
|
warn "$_ is not recognized as a valid field, ignoring" if $ENV{CHESS_FIDE_VERBOSE}; |
51
|
1
|
|
|
|
|
2
|
next; |
52
|
|
|
|
|
|
|
} |
53
|
429917
|
50
|
|
|
|
1094188
|
$player->{$_} = defined $param{$_} ? $param{$_} : $FIDE_defaults{$_}; |
54
|
|
|
|
|
|
|
} |
55
|
29996
|
|
|
|
|
149276
|
for (keys %FIDE_defaults) { |
56
|
629916
|
|
100
|
|
|
1837476
|
$player->{$_} ||= $FIDE_defaults{$_}; |
57
|
|
|
|
|
|
|
} |
58
|
29996
|
100
|
|
|
|
96830
|
$player->{fed} = 'UNK' if $player->{fed} eq '*'; |
59
|
29996
|
100
|
66
|
|
|
114563
|
$player->{sex} ||= $player->{flag} =~ /^w/ ? 'F' : 'M'; |
60
|
29996
|
100
|
|
|
|
58383
|
$player->{otit} =~ s/^\,// if $player->{otit}; |
61
|
29996
|
100
|
100
|
|
|
67199
|
$player->{tit} = 'i' if $player->{tit} && $player->{tit} eq 'm'; |
62
|
29996
|
100
|
100
|
|
|
68089
|
$player->{tit} = 'wi' if $player->{tit} && $player->{tit} eq 'wm'; |
63
|
|
|
|
|
|
|
$player->{tit} = uc($player->{tit}) . 'M' |
64
|
29996
|
100
|
66
|
|
|
75932
|
if $player->{tit} && $player->{tit} ne 'WH' && $player->{tit} !~ /m$/i; |
|
|
|
100
|
|
|
|
|
65
|
29996
|
|
|
|
|
48040
|
$player->{fed} = uc($player->{fed}); |
66
|
29996
|
|
|
|
|
138132
|
return $player; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub AUTOLOAD ($;$) { |
70
|
|
|
|
|
|
|
|
71
|
474054
|
|
|
474054
|
|
9890218
|
my $self = shift; |
72
|
474054
|
|
|
|
|
613952
|
my $param = shift; |
73
|
|
|
|
|
|
|
|
74
|
474054
|
|
|
|
|
634503
|
my $method = $AUTOLOAD; |
75
|
474054
|
|
|
|
|
720446
|
$method = lc $method; |
76
|
474054
|
|
|
|
|
1278120
|
my @path = split(/\:\:/, $method); |
77
|
474054
|
|
|
|
|
661701
|
$method = pop @path; |
78
|
474054
|
50
|
|
|
|
1065466
|
return if $method =~ /^destroy$/; |
79
|
474054
|
100
|
|
|
|
1028104
|
unless (exists $self->{$method}) { |
80
|
2
|
|
|
|
|
271
|
carp "No such method or property $method"; |
81
|
2
|
|
|
|
|
202
|
return undef; |
82
|
|
|
|
|
|
|
} |
83
|
474052
|
100
|
|
|
|
774604
|
$self->{$method} = $param if ($param); |
84
|
474052
|
|
|
|
|
1939604
|
$self->{$method}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |