line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OATH::Server::Lite::DataHandler; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
43968
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
188
|
|
4
|
5
|
|
|
5
|
|
19
|
use warnings; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
1342
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Net::OATH::Server::Lite::DataHandler - Base class that specifies interface for data handler for your server. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
This connects Net::OATH::Server::Lite library to your service. |
13
|
|
|
|
|
|
|
This specifies an interface to handle data stored in your application. |
14
|
|
|
|
|
|
|
You must inherit this and implement the subroutines according to the interface contract. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package YourDataHandler; |
19
|
|
|
|
|
|
|
use strict; |
20
|
|
|
|
|
|
|
use warnings; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use parent 'Net::OATH::Server::Lite::DataHandler'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
27
|
23
|
|
|
23
|
0
|
3859
|
my ($class, %args) = @_; |
28
|
23
|
|
|
|
|
97
|
my $self = bless { request => undef, %args }, $class; |
29
|
23
|
|
|
|
|
50
|
$self->init; |
30
|
23
|
|
|
|
|
51
|
$self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 init |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This method can be implemented to initialize your subclass. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub init { |
42
|
23
|
|
|
23
|
1
|
35
|
my $self = shift; |
43
|
|
|
|
|
|
|
# template method |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 INTERFACES |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 request |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Returns <Plack::Request> object. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub request { |
55
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
56
|
0
|
|
|
|
|
|
return $self->{request}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 create_id |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Returns identifier of new user object. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub create_id { |
66
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
67
|
0
|
|
|
|
|
|
die "abstract method"; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 create_secret |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Returns raw secret of new user object. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub create_secret { |
77
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
78
|
0
|
|
|
|
|
|
die "abstract method"; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# For Register |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 insert_user( $user ) |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Inserts new user object to your datastore and returnes result as a boolean. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub insert_user { |
90
|
0
|
|
|
0
|
1
|
|
my ($self, $user) = @_; |
91
|
0
|
|
|
|
|
|
die "abstract method"; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# For Login and User Object |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 select_user( $id ) |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Return user object which is found by $id. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub select_user { |
103
|
0
|
|
|
0
|
1
|
|
my ($self, $id) = @_; |
104
|
0
|
|
|
|
|
|
die "abstract method"; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# For User Object |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 update_user( $user ) |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Updates user object on your datastore and returnes result as a boolean. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub update_user { |
116
|
0
|
|
|
0
|
1
|
|
my ($self, $user) = @_; |
117
|
0
|
|
|
|
|
|
die "abstract method"; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 delete_user( $id ) |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Deletes user object which is found by $id on your datastore and returnes result as a boolean. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub delete_user { |
127
|
0
|
|
|
0
|
1
|
|
my ($self, $id) = @_; |
128
|
0
|
|
|
|
|
|
die "abstract method"; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |