line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Session::ID::UUID36; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
551
|
use parent 'Data::Session::ID'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
1
|
|
|
1
|
|
65
|
no autovivification; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
5
|
1
|
|
|
1
|
|
44
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use Data::UUID; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
90
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
8
|
use Hash::FieldHash ':all'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
337
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '1.17'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# ----------------------------------------------- |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub generate |
17
|
|
|
|
|
|
|
{ |
18
|
19
|
|
|
19
|
0
|
31
|
my($self) = @_; |
19
|
|
|
|
|
|
|
|
20
|
19
|
|
|
|
|
24325
|
return Data::UUID -> new -> create_str; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
} # End of generate. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# ----------------------------------------------- |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub id_length |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
0
|
0
|
0
|
my($self) = @_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
0
|
return 36; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
} # End of id_length. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# ----------------------------------------------- |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub init |
37
|
|
|
|
|
|
|
{ |
38
|
36
|
|
|
36
|
0
|
73
|
my($self, $arg) = @_; |
39
|
36
|
|
|
|
|
69
|
$$arg{id_length} = 36; # Bytes. |
40
|
36
|
|
50
|
|
|
102
|
$$arg{verbose} ||= 0; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} # End of init. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# ----------------------------------------------- |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub new |
47
|
|
|
|
|
|
|
{ |
48
|
36
|
|
|
36
|
1
|
243
|
my($class, %arg) = @_; |
49
|
|
|
|
|
|
|
|
50
|
36
|
|
|
|
|
119
|
$class -> init(\%arg); |
51
|
|
|
|
|
|
|
|
52
|
36
|
|
|
|
|
2153
|
return from_hash(bless({}, $class), \%arg); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} # End of new. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# ----------------------------------------------- |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=pod |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
L - A persistent session manager |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 Synopsis |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
See L for details. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 Description |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
L allows L to generate session ids using L. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
To use this module do this: |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=over 4 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item o Specify an id generator of type UUID36, as Data::Session -> new(type => '... id:UUID36 ...') |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=back |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 Case-sensitive Options |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
See L for important information. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 Method: new() |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Creates a new object of type L. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
C takes a hash of key/value pairs, some of which might mandatory. Further, some combinations |
91
|
|
|
|
|
|
|
might be mandatory. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The keys are listed here in alphabetical order. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
They are lower-case because they are (also) method names, meaning they can be called to set or get |
96
|
|
|
|
|
|
|
the value at any time. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item o verbose => $integer |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Print to STDERR more or less information. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Typical values are 0, 1 and 2. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This key is normally passed in as Data::Session -> new(verbose => $integer). |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This key is optional. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=back |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 Method: generate() |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Generates the next session id, or dies if it can't. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
The algorithm is Data::UUID -> new -> create_str. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Returns the new id. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 Method: id_length() |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Returns 36 because that's the number of bytes in a UUID36 digest. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This can be used to generate the SQL to create the sessions table. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
See scripts/digest.pl. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 Support |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Log a bug on RT: L. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 Author |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L was written by Ron Savage Iron@savage.net.auE> in 2010. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Home page: L. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 Copyright |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Australian copyright (c) 2010, Ron Savage. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
All Programs of mine are 'OSI Certified Open Source Software'; |
143
|
|
|
|
|
|
|
you can redistribute them and/or modify them under the terms of |
144
|
|
|
|
|
|
|
The Artistic License, a copy of which is available at: |
145
|
|
|
|
|
|
|
http://www.opensource.org/licenses/index.html |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |