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