line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# E2::Session |
2
|
|
|
|
|
|
|
# Jose M. Weeks |
3
|
|
|
|
|
|
|
# 29 June 2003 |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# See bottom for pod documentation. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package E2::Session; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
856
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
10
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
11
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
12
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
83
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
6
|
use E2::Ticker; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1703
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = "0.33"; |
17
|
|
|
|
|
|
|
our @ISA = qw(E2::Ticker); |
18
|
|
|
|
|
|
|
our $DEBUG; *DEBUG = *E2::Interface::DEBUG; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new; |
21
|
|
|
|
|
|
|
sub clear; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub update; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub time; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub votes; |
28
|
|
|
|
|
|
|
sub cools; |
29
|
|
|
|
|
|
|
sub karma; |
30
|
|
|
|
|
|
|
sub experience; |
31
|
|
|
|
|
|
|
sub writeups; |
32
|
|
|
|
|
|
|
sub borged; |
33
|
|
|
|
|
|
|
sub forbidden; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub xpchange; |
36
|
|
|
|
|
|
|
sub nextlevel; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
39
|
0
|
|
|
0
|
1
|
|
my $arg = shift; |
40
|
0
|
|
0
|
|
|
|
my $class = ref( $arg ) || $arg; |
41
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(); |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return bless ($self, $class); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub clear { |
47
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: clear E2SESSION"; |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
warn "E2::Session::clear\n" if $DEBUG > 1; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$self->{votes} = undef; |
52
|
0
|
|
|
|
|
|
$self->{cools} = undef; |
53
|
0
|
|
|
|
|
|
$self->{karma} = undef; |
54
|
0
|
|
|
|
|
|
$self->{experience} = undef; |
55
|
0
|
|
|
|
|
|
$self->{writeups} = undef; |
56
|
0
|
|
|
|
|
|
$self->{borged} = undef; |
57
|
0
|
|
|
|
|
|
$self->{forbidden} = undef; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$self->{time} = undef; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
$self->{xpchange} = undef; |
62
|
0
|
|
|
|
|
|
$self->{nextlevel} = {}; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
@{ $self->{personal} } = (); |
|
0
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
return 1; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub votes { |
70
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: votes E2SESSION"; |
71
|
0
|
|
|
|
|
|
return $self->{votes}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub cools { |
75
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: cools E2SESSION"; |
76
|
0
|
|
|
|
|
|
return $self->{cools}; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub karma { |
80
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak "Usage: karma E2SESSION"; |
81
|
0
|
|
|
|
|
|
return $self->{karma}; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub experience { |
85
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: experience E2SESSION"; |
86
|
0
|
|
|
|
|
|
return $self->{experience}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub writeups { |
90
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: writeups E2SESSION"; |
91
|
0
|
|
|
|
|
|
return $self->{writeups}; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub borged { |
95
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: borged E2SESSION"; |
96
|
0
|
|
|
|
|
|
return $self->{borged}; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub forbidden { |
100
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: forbidden E2SESSION"; |
101
|
0
|
|
|
|
|
|
return $self->{forbidden}; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub time { |
105
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: time E2SESSION"; |
106
|
0
|
|
|
|
|
|
return $self->{time}; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub xpchange { |
110
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: xpchange E2SESSION"; |
111
|
0
|
|
|
|
|
|
return $self->{xpchange}; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub nextlevel { |
115
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: nextlevel E2SESSION"; |
116
|
0
|
|
|
|
|
|
return $self->{nextlevel}; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub list_personal_nodes { |
120
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak "Usage: list_personal_nodes E2SESSION"; |
121
|
0
|
|
|
|
|
|
return @{ $self->{personal} }; |
|
0
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub update { |
125
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: update E2SESSION"; |
126
|
|
|
|
|
|
|
|
127
|
0
|
0
|
|
|
|
|
warn "E2::Session::update\n" if $DEBUG > 1; |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
my $handlers = { |
130
|
|
|
|
|
|
|
'currentuser' => sub { |
131
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
132
|
0
|
|
|
|
|
|
${$self->{this_username}} = $b->text; |
|
0
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
${$self->{this_user_id}} = $b->{att}->{user_id}; |
|
0
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
}, |
135
|
|
|
|
|
|
|
'servertime' => sub { |
136
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
137
|
0
|
|
|
|
|
|
$self->{time} = $b->text; |
138
|
|
|
|
|
|
|
}, |
139
|
|
|
|
|
|
|
'borgstatus' => sub { |
140
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
141
|
0
|
|
|
|
|
|
$self->{borged} = $b->{att}->{value}; |
142
|
|
|
|
|
|
|
}, |
143
|
|
|
|
|
|
|
'cools' => sub { |
144
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
145
|
0
|
|
|
|
|
|
$self->{cools} = $b->text; |
146
|
|
|
|
|
|
|
}, |
147
|
|
|
|
|
|
|
'votesleft' => sub { |
148
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
149
|
0
|
|
|
|
|
|
$self->{votes} = $b->text; |
150
|
|
|
|
|
|
|
}, |
151
|
|
|
|
|
|
|
'karma' => sub { |
152
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
153
|
0
|
|
|
|
|
|
$self->{karma} = $b->text; |
154
|
|
|
|
|
|
|
}, |
155
|
|
|
|
|
|
|
'experience' => sub { |
156
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
157
|
0
|
|
|
|
|
|
$self->{experience} = $b->text; |
158
|
|
|
|
|
|
|
}, |
159
|
|
|
|
|
|
|
'numwriteups' => sub { |
160
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
161
|
0
|
|
|
|
|
|
$self->{writeups} = $b->text; |
162
|
|
|
|
|
|
|
}, |
163
|
|
|
|
|
|
|
'forbiddance' => sub { |
164
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
165
|
0
|
|
|
|
|
|
$self->{forbidden} = $b->text; |
166
|
|
|
|
|
|
|
}, |
167
|
|
|
|
|
|
|
'xpinfo' => sub { |
168
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
169
|
0
|
0
|
|
|
|
|
if( my $c = $b->first_child('xpchange') ) { |
170
|
0
|
|
|
|
|
|
$self->{xpchange} = $c->text; |
171
|
|
|
|
|
|
|
} |
172
|
0
|
0
|
|
|
|
|
if( my $c = $b->first_child('nextlevel') ) { |
173
|
0
|
|
|
|
|
|
$self->{nextlevel} = { |
174
|
|
|
|
|
|
|
experience => $c->{att}-> |
175
|
|
|
|
|
|
|
{experience}, |
176
|
|
|
|
|
|
|
writeups => $c->{att}-> |
177
|
|
|
|
|
|
|
{writeups}, |
178
|
|
|
|
|
|
|
level => $c->text |
179
|
|
|
|
|
|
|
}; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
}, |
182
|
|
|
|
|
|
|
'personalnodes/e2node' => sub { |
183
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
184
|
0
|
|
|
|
|
|
push @{ $self->{personal} }, { |
|
0
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
title => $b->text, |
186
|
|
|
|
|
|
|
id => $b->{att}->{node_id} |
187
|
|
|
|
|
|
|
}; |
188
|
|
|
|
|
|
|
} |
189
|
0
|
|
|
|
|
|
}; |
190
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
$self->clear; |
192
|
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
|
$self->parse( 'session', $handlers, [ 1 ] ); |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
1; |
197
|
|
|
|
|
|
|
__END__ |