line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Face::Store; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
34878
|
use 5.006; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1279
|
use Storable; |
|
1
|
|
|
|
|
3733
|
|
|
1
|
|
|
|
|
599
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
WebService::Face::Store |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.04 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
WebService::Face::Store wraps the data returned by the server for account data |
24
|
|
|
|
|
|
|
(limits, users, namespacs) |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
It provides a simple OO interface to access the data |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
For a better understanding of the data structure you can read : |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=over 4 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=item * L |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item * L |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item * L |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=back |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 new ( \%params ) |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
The constructor for the WebService::Face::Store class |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
49
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
50
|
0
|
|
0
|
|
|
|
my $params = shift || {}; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
for my $key ( keys %$params ) { |
55
|
0
|
|
|
|
|
|
$self->{$key} = $params->{$key}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 create_user () |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Getter for the 'create_user' attribute |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub create_user { |
68
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
69
|
0
|
|
|
|
|
|
my $user = shift; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $exist = exists $self->{_data}{USER}{$user}; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
$self->{_data}{USER}{$user} = 1; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return !$exist; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 delete_user () |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Getter for the 'delete_user' attribute |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub delete_user { |
85
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
86
|
0
|
|
|
|
|
|
my $user = shift; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my $exist = $self->{_data}{USER}{$user}; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
delete $self->{_data}{USER}{$user}; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
return $exist; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 list_users () |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Getter for the 'list_users' attribute |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub list_users { |
102
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
103
|
0
|
|
|
|
|
|
my $user = shift; |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
return keys %{ $self->{_data}{USER} }; |
|
0
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 train_user () |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Getter for the 'train_user' attribute |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub train_user { |
115
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
116
|
0
|
|
|
|
|
|
my $user = shift; |
117
|
0
|
|
|
|
|
|
my $photo = shift; |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
push @{$self->{_data}{PHOTO}{$user}}, $photo; |
|
0
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
return scalar @{$self->{_data}{PHOTO}{$user}}; |
|
0
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 get_user () |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Getter for the 'get_user' attribute |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub get_user { |
131
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
return $self->{'get_user'}; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 set_user () |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Getter for the 'set_user' attribute |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub set_user { |
143
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
return $self->{'set_user'}; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 recognize_user () |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Getter for the 'recognize_user' attribute |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub recognize_user { |
155
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
156
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
|
return $self->{'recognize_user'}; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 save () |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Getter for the 'save' attribute |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub save { |
167
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
168
|
0
|
|
|
|
|
|
my $filename = shift; |
169
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
$filename =~ s/[^a-zA-Z\d_]//g; |
171
|
|
|
|
|
|
|
|
172
|
0
|
0
|
|
|
|
|
store $self, "$filename" or die "Can't save Store ($!)"; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 restore () |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Getter for the 'restore' attribute |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=cut |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
sub restore { |
182
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
183
|
0
|
|
|
|
|
|
my $filename = shift; |
184
|
|
|
|
|
|
|
|
185
|
0
|
0
|
|
|
|
|
$self = retrieve($filename) or die "Can't restore store ($!)"; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 AUTHOR |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Arnaud (Arhuman) ASSAD, C<< >> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 BUGS |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Please report any bugs or feature requests to C< arhuman at gmail.com>, or through |
195
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
196
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 SUPPORT |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
perldoc WebService::Face::Client |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
You can also look for information at: |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=over 4 |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * Github repository |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
L |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
L |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item * CPAN Ratings |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
L |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=back |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
More information about Face.com service : |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
L |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Thanks to Face.com for the service they provide. |
229
|
|
|
|
|
|
|
Thanks to Jaguar Network for allowing me to publish my work. |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
Copyright 2012 Arnaud (Arhuman) ASSAD. |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
236
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
237
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=cut |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
1; |