line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# E2::User |
2
|
|
|
|
|
|
|
# Jose M. Weeks |
3
|
|
|
|
|
|
|
# 05 June 2003 |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# See bottom for pod documentation. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package E2::User; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
26262
|
use 5.006; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
298
|
|
10
|
2
|
|
|
2
|
|
98
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
165
|
|
11
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
59
|
|
12
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
194
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
1066
|
use E2::Node; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
4051
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = "0.32"; |
17
|
|
|
|
|
|
|
our @ISA = qw(E2::Node); |
18
|
|
|
|
|
|
|
our $DEBUG; *DEBUG = *E2::Interface::DEBUG; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new; |
21
|
|
|
|
|
|
|
sub clear; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub name; |
24
|
|
|
|
|
|
|
sub id; |
25
|
|
|
|
|
|
|
sub alias; |
26
|
|
|
|
|
|
|
sub alias_id; |
27
|
|
|
|
|
|
|
sub text; |
28
|
|
|
|
|
|
|
sub lasttime; |
29
|
|
|
|
|
|
|
sub experience; |
30
|
|
|
|
|
|
|
sub level; |
31
|
|
|
|
|
|
|
sub level_string; |
32
|
|
|
|
|
|
|
sub writeup_count; |
33
|
|
|
|
|
|
|
sub cool_count; |
34
|
|
|
|
|
|
|
sub image_url; |
35
|
|
|
|
|
|
|
sub lastnode; |
36
|
|
|
|
|
|
|
sub lastnode_id; |
37
|
|
|
|
|
|
|
sub mission; |
38
|
|
|
|
|
|
|
sub specialties; |
39
|
|
|
|
|
|
|
sub motto; |
40
|
|
|
|
|
|
|
sub employment; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub groups; |
43
|
|
|
|
|
|
|
sub bookmarks; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
46
|
1
|
|
|
1
|
1
|
165
|
my $arg = shift; |
47
|
1
|
|
33
|
|
|
9
|
my $class = ref( $arg ) || $arg; |
48
|
1
|
|
|
|
|
15
|
my $self = $class->SUPER::new(); |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
9
|
$self->clear; |
51
|
1
|
|
|
|
|
2
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub clear { |
55
|
3
|
50
|
|
3
|
0
|
18
|
my $self = shift or croak "Usage: clear E2USER"; |
56
|
|
|
|
|
|
|
|
57
|
3
|
50
|
|
|
|
7
|
warn "E2::User::clear\n" if $DEBUG > 1; |
58
|
|
|
|
|
|
|
|
59
|
3
|
|
|
|
|
7
|
$self->{alias} = undef; |
60
|
3
|
|
|
|
|
5
|
$self->{alias_id} = undef; |
61
|
3
|
|
|
|
|
6
|
$self->{text} = undef; # Homenode text |
62
|
3
|
|
|
|
|
7
|
$self->{lasttime} = undef; |
63
|
3
|
|
|
|
|
5
|
$self->{experience} = undef; |
64
|
3
|
|
|
|
|
4
|
$self->{level} = undef; # Integer |
65
|
3
|
|
|
|
|
5
|
$self->{level_string} = undef; # Ex: "3 (Acolyte)" |
66
|
3
|
|
|
|
|
6
|
$self->{writeup_num} = undef; |
67
|
3
|
|
|
|
|
4
|
$self->{cool_num} = undef; |
68
|
3
|
|
|
|
|
5
|
$self->{image} = undef; # Relative URL |
69
|
3
|
|
|
|
|
4
|
$self->{lastnode} = undef; |
70
|
3
|
|
|
|
|
6
|
$self->{lastnode_id} = undef; |
71
|
3
|
|
|
|
|
5
|
$self->{mission} = undef; |
72
|
3
|
|
|
|
|
4
|
$self->{specialties} = undef; |
73
|
3
|
|
|
|
|
5
|
$self->{motto} = undef; |
74
|
3
|
|
|
|
|
3
|
$self->{employment} = undef; |
75
|
3
|
|
|
|
|
5
|
$self->{groups} = (); # these are lists of hashrefs |
76
|
3
|
|
|
|
|
4
|
$self->{bookmarks} = (); # with the following keys: |
77
|
|
|
|
|
|
|
# o title |
78
|
|
|
|
|
|
|
# o id |
79
|
|
|
|
|
|
|
|
80
|
3
|
|
|
|
|
15
|
return $self->SUPER::clear; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub type_as_string { |
84
|
1
|
|
|
1
|
0
|
17
|
return 'user'; |
85
|
|
|
|
|
|
|
}; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub twig_handlers { |
88
|
1
|
50
|
|
1
|
0
|
5
|
my $self = shift or croak "Usage: twig_handlers E2USER"; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
return ( |
91
|
|
|
|
|
|
|
'useralias/e2link' => sub { |
92
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
93
|
0
|
|
|
|
|
|
$self->{alias} = $b->text; |
94
|
0
|
|
|
|
|
|
$self->{alias_id} = $b->{att}->{node_id}; |
95
|
|
|
|
|
|
|
}, |
96
|
|
|
|
|
|
|
'node/doctext' => sub { |
97
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
98
|
0
|
|
|
|
|
|
$self->{text} = $b->text; |
99
|
|
|
|
|
|
|
}, |
100
|
|
|
|
|
|
|
'experience' => sub { |
101
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
102
|
0
|
|
|
|
|
|
$self->{experience} = $b->text; |
103
|
|
|
|
|
|
|
}, |
104
|
|
|
|
|
|
|
'lasttime' => sub { |
105
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
106
|
0
|
|
|
|
|
|
$self->{lasttime} = $b->text; |
107
|
|
|
|
|
|
|
}, |
108
|
|
|
|
|
|
|
'level' => sub { |
109
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
110
|
0
|
|
|
|
|
|
$self->{level} = $b->{att}->{value}; |
111
|
0
|
|
|
|
|
|
$self->{level_string} = $b->text; |
112
|
|
|
|
|
|
|
}, |
113
|
|
|
|
|
|
|
'writeups' => sub { |
114
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
115
|
0
|
|
|
|
|
|
$self->{writeup_num} = $b->text; |
116
|
|
|
|
|
|
|
}, |
117
|
|
|
|
|
|
|
'image' => sub { |
118
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
119
|
0
|
|
|
|
|
|
$self->{image} = $b->text; |
120
|
|
|
|
|
|
|
}, |
121
|
|
|
|
|
|
|
'lastnoded/e2link' => sub { |
122
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
123
|
0
|
|
|
|
|
|
$self->{lastnode} = $b->text; |
124
|
0
|
|
|
|
|
|
$self->{lastnode_id} = $b->{att}->{node_id}; |
125
|
|
|
|
|
|
|
}, |
126
|
|
|
|
|
|
|
'cools' => sub { |
127
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
128
|
0
|
|
|
|
|
|
$self->{cool_num} = $b->text; |
129
|
|
|
|
|
|
|
}, |
130
|
|
|
|
|
|
|
'userstrings/mission' => sub { |
131
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
132
|
0
|
|
|
|
|
|
$self->{mission} = $b->text; |
133
|
|
|
|
|
|
|
}, |
134
|
|
|
|
|
|
|
'userstrings/specialties' => sub { |
135
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
136
|
0
|
|
|
|
|
|
$self->{specialties} = $b->text; |
137
|
|
|
|
|
|
|
}, |
138
|
|
|
|
|
|
|
'userstrings/motto' => sub { |
139
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
140
|
0
|
|
|
|
|
|
$self->{motto} = $b->text; |
141
|
|
|
|
|
|
|
}, |
142
|
|
|
|
|
|
|
'userstrings/employment' => sub { |
143
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
144
|
0
|
|
|
|
|
|
$self->{employment} = $b->text; |
145
|
|
|
|
|
|
|
}, |
146
|
|
|
|
|
|
|
'groupmembership/e2link' => sub { |
147
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
148
|
0
|
|
|
|
|
|
push @{ $self->{groups} }, { |
|
0
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
title => $b->text, |
150
|
|
|
|
|
|
|
id => $b->{att}->{node_id} |
151
|
|
|
|
|
|
|
}; |
152
|
|
|
|
|
|
|
}, |
153
|
|
|
|
|
|
|
'bookmarks/e2link' => sub { |
154
|
0
|
|
|
0
|
|
|
(my $a, my $b) = @_; |
155
|
0
|
|
|
|
|
|
push @{ $self->{bookmarks} }, { |
|
0
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
title => $b->text, |
157
|
|
|
|
|
|
|
id => $b->{att}->{node_id} |
158
|
|
|
|
|
|
|
}; |
159
|
|
|
|
|
|
|
} |
160
|
1
|
|
|
|
|
62
|
); |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
#--------------- |
164
|
|
|
|
|
|
|
# Access Members |
165
|
|
|
|
|
|
|
#--------------- |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub name { |
168
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: name E2USER"; |
169
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
return $self->title; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub id { |
174
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: id E2USER"; |
175
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
|
return $self->node_id; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub alias { |
180
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: alias E2USER"; |
181
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
|
return $self->{alias}; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
sub alias_id { |
186
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: alias_id E2USER"; |
187
|
|
|
|
|
|
|
|
188
|
0
|
|
|
|
|
|
return $self->{alias_id}; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub text { |
192
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: text E2USER"; |
193
|
|
|
|
|
|
|
|
194
|
0
|
|
|
|
|
|
return $self->{text}; |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub lasttime { |
198
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: lasttime E2USER"; |
199
|
|
|
|
|
|
|
|
200
|
0
|
|
|
|
|
|
return $self->{lasttime}; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub experience { |
204
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: experience E2USER"; |
205
|
|
|
|
|
|
|
|
206
|
0
|
|
|
|
|
|
return $self->{experience}; |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
sub level { |
210
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: level E2USER"; |
211
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
return $self->{level}; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
sub level_string { |
216
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: level_string E2USER"; |
217
|
|
|
|
|
|
|
|
218
|
0
|
|
|
|
|
|
return $self->{level_string}; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
sub writeup_count { |
222
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: writeup_count E2USER"; |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
return $self->{writeup_num}; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub cool_count { |
228
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: cool_count E2USER"; |
229
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
|
return $self->{cool_num}; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub image_url { |
234
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: image_url E2USER"; |
235
|
|
|
|
|
|
|
|
236
|
0
|
|
|
|
|
|
return $self->{image}; |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
sub lastnode { |
240
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: lastnode E2USER"; |
241
|
|
|
|
|
|
|
|
242
|
0
|
|
|
|
|
|
return $self->{lastnode}; |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub lastnode_id { |
246
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: lastnode_id E2USER"; |
247
|
|
|
|
|
|
|
|
248
|
0
|
|
|
|
|
|
return $self->{lastnode_id}; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
sub mission { |
252
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: mission E2USER"; |
253
|
|
|
|
|
|
|
|
254
|
0
|
|
|
|
|
|
return $self->{mission}; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
sub specialties { |
258
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: specialties E2USER"; |
259
|
|
|
|
|
|
|
|
260
|
0
|
|
|
|
|
|
return $self->{specialties}; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
sub motto { |
264
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: motto E2USER"; |
265
|
|
|
|
|
|
|
|
266
|
0
|
|
|
|
|
|
return $self->{motto}; |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub employment { |
270
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: employment E2USER"; |
271
|
|
|
|
|
|
|
|
272
|
0
|
|
|
|
|
|
return $self->{employment}; |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub groups { |
276
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: groups E2USER"; |
277
|
0
|
0
|
|
|
|
|
if( ! defined $self->{groups} ) { return (); } |
|
0
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
|
return @{ $self->{groups} }; |
|
0
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub bookmarks { |
282
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or croak "Usage: bookmarks E2USER"; |
283
|
0
|
0
|
|
|
|
|
if( ! defined $self->{bookmarks} ) { return (); } |
|
0
|
|
|
|
|
|
|
284
|
0
|
|
|
|
|
|
return @{ $self->{bookmarks} }; |
|
0
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
1; |
288
|
|
|
|
|
|
|
__END__ |