line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Redis::LeaderBoard::Member; |
2
|
9
|
|
|
9
|
|
50
|
use Mouse; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
49
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has leader_board => ( |
5
|
|
|
|
|
|
|
is => 'ro', |
6
|
|
|
|
|
|
|
isa => 'Redis::LeaderBoard', |
7
|
|
|
|
|
|
|
required => 1, |
8
|
|
|
|
|
|
|
); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has member => ( |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
isa => 'Str', |
13
|
|
|
|
|
|
|
required => 1, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
9
|
|
|
9
|
|
3125
|
no Mouse; |
|
9
|
|
|
|
|
42
|
|
|
9
|
|
|
|
|
56
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub score { |
19
|
0
|
|
|
0
|
1
|
|
my ($self, $score) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
return $self->leader_board->get_score($self->member) unless $score; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$self->leader_board->set_score($self->member, $score); |
24
|
0
|
|
|
|
|
|
$score; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub incr { |
28
|
0
|
|
|
0
|
1
|
|
my ($self, $score) = @_; |
29
|
0
|
0
|
|
|
|
|
$score = defined $score ? $score : 1; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$self->leader_board->incr_score($self->member, $score); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub decr { |
35
|
0
|
|
|
0
|
1
|
|
my ($self, $score) = @_; |
36
|
0
|
0
|
|
|
|
|
$score = defined $score ? $score : 1; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$self->leader_board->decr_score($self->member, $score); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub rank_with_score { |
42
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
43
|
0
|
|
|
|
|
|
$self->leader_board->get_rank_with_score($self->member); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub rank { |
47
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
48
|
0
|
|
|
|
|
|
$self->leader_board->get_rank($self->member); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub sorted_order { |
52
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$self->leader_board->sorted_order($self->member); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
__END__ |