line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Apache::AppSamurai:Session - Extension/wrapper for Apache::Session providing |
2
|
|
|
|
|
|
|
# the same interface as Apache::Session::Flex with the ability to use |
3
|
|
|
|
|
|
|
# additional features. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# $Id: Session.pm,v 1.9 2008/04/30 21:40:06 pauldoom Exp $ |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
## |
8
|
|
|
|
|
|
|
# Copyright (c) 2008 Paul M. Hirsch (paul@voltagenoir.org). |
9
|
|
|
|
|
|
|
# All rights reserved. |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify it under |
12
|
|
|
|
|
|
|
# the same terms as Perl itself. |
13
|
|
|
|
|
|
|
## |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Includes code from Apache::Session developed by Jeffrey William Baker |
16
|
|
|
|
|
|
|
# (jwbaker@acm.org) and others. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Apache::AppSamurai::Session; |
19
|
1
|
|
|
1
|
|
43642
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
238
|
|
20
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
8
|
use vars qw($VERSION @ISA $incl); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
151
|
|
23
|
|
|
|
|
|
|
$VERSION = substr(q$Revision: 1.9 $, 10, -1); |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
1389
|
use Apache::Session; |
|
1
|
|
|
|
|
3119
|
|
|
1
|
|
|
|
|
1125
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
@ISA = qw( Apache::Session ); |
28
|
|
|
|
|
|
|
$incl = {}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub populate { |
31
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Allow standard Apache::Session syntax, special AppSamurai/-
|
34
|
|
|
|
|
|
|
# syntax, or specifying a full module path. |
35
|
0
|
|
|
|
|
|
my ($store, $lock, $gen, $ser); |
36
|
0
|
0
|
|
|
|
|
if ($self->{args}->{Store} =~ /^AppSamurai\/([\w\d\_]+?)\s*$/i) { |
|
|
0
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$store = "Apache::AppSamurai::Session::Store::$1"; |
38
|
|
|
|
|
|
|
} elsif ($self->{args}->{Store} =~ /::/) { |
39
|
0
|
|
|
|
|
|
$store = $self->{args}->{Store}; |
40
|
|
|
|
|
|
|
} else { |
41
|
0
|
|
|
|
|
|
$store = "Apache::Session::Store::$self->{args}->{Store}"; |
42
|
|
|
|
|
|
|
} |
43
|
0
|
0
|
|
|
|
|
if ($self->{args}->{Lock} =~ /^AppSamurai\/([\w\d\_]+?)\s*$/i) { |
|
|
0
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$lock = "Apache::AppSamurai::Session::Lock::$1"; |
45
|
|
|
|
|
|
|
} elsif ($self->{args}->{Lock} =~ /::/) { |
46
|
0
|
|
|
|
|
|
$lock = $self->{args}->{Lock}; |
47
|
|
|
|
|
|
|
} else { |
48
|
0
|
|
|
|
|
|
$lock = "Apache::Session::Lock::$self->{args}->{Lock}"; |
49
|
|
|
|
|
|
|
} |
50
|
0
|
0
|
|
|
|
|
if ($self->{args}->{Generate} =~ /^AppSamurai\/([\w\d\_]+?)\s*$/i) { |
|
|
0
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$gen = "Apache::AppSamurai::Session::Generate::$1"; |
52
|
|
|
|
|
|
|
} elsif ($self->{args}->{Generate} =~ /::/) { |
53
|
0
|
|
|
|
|
|
$gen = $self->{args}->{Generate}; |
54
|
|
|
|
|
|
|
} else { |
55
|
0
|
|
|
|
|
|
$gen = "Apache::Session::Generate::$self->{args}->{Generate}"; |
56
|
|
|
|
|
|
|
} |
57
|
0
|
0
|
|
|
|
|
if ($self->{args}->{Serialize} =~ /^AppSamurai\/([\w\d\_]+?)\s*$/i) { |
|
|
0
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$ser = "Apache::AppSamurai::Session::Serialize::$1"; |
59
|
|
|
|
|
|
|
} elsif ($self->{args}->{Serialize} =~ /::/) { |
60
|
0
|
|
|
|
|
|
$ser = $self->{args}->{Serialize}; |
61
|
|
|
|
|
|
|
} else { |
62
|
0
|
|
|
|
|
|
$ser = "Apache::Session::Serialize::$self->{args}->{Serialize}"; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
if (!exists $incl->{$store}) { |
66
|
0
|
0
|
|
|
|
|
eval "require $store" || die $@; |
67
|
0
|
|
|
|
|
|
$incl->{$store} = 1; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
if (!exists $incl->{$lock}) { |
71
|
0
|
0
|
|
|
|
|
eval "require $lock" || die $@; |
72
|
0
|
|
|
|
|
|
$incl->{$lock} = 1; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
if (!exists $incl->{$gen}) { |
76
|
0
|
0
|
|
|
|
|
eval "require $gen" || die $@; |
77
|
0
|
0
|
|
|
|
|
eval '$incl->{$gen}->[0] = \&' . $gen . '::generate' || die $@; |
78
|
0
|
0
|
|
|
|
|
eval '$incl->{$gen}->[1] = \&' . $gen . '::validate' || die $@; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
if (!exists $incl->{$ser}) { |
82
|
0
|
0
|
|
|
|
|
eval "require $ser" || die $@; |
83
|
0
|
0
|
|
|
|
|
eval '$incl->{$ser}->[0] = \&' . $ser . '::serialize' || die $@; |
84
|
0
|
0
|
|
|
|
|
eval '$incl->{$ser}->[1] = \&' . $ser . '::unserialize' || die $@; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
$self->{object_store} = new $store $self; |
88
|
0
|
|
|
|
|
|
$self->{lock_manager} = new $lock $self; |
89
|
0
|
|
|
|
|
|
$self->{generate} = $incl->{$gen}->[0]; |
90
|
0
|
|
|
|
|
|
$self->{validate} = $incl->{$gen}->[1]; |
91
|
0
|
|
|
|
|
|
$self->{serialize} = $incl->{$ser}->[0]; |
92
|
0
|
|
|
|
|
|
$self->{unserialize} = $incl->{$ser}->[1]; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return $self; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; # End of Apache::AppSamurai::Session |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__END__ |