| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
OpenFrame::WebApp::Session::Factory - a factory for various types of session |
|
4
|
|
|
|
|
|
|
wrappers. |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use OpenFrame::WebApp::Session::Factory; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $sfactory = new OpenFrame::WebApp::Session::Factory() |
|
11
|
|
|
|
|
|
|
->type( 'file_cache' ) |
|
12
|
|
|
|
|
|
|
->expiry( $period ); # optional |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $session = $sfactory->new_session( @args ); |
|
15
|
|
|
|
|
|
|
my $session = $sfactory->fetch_session( $id ); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package OpenFrame::WebApp::Session::Factory; |
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
19768
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
30
|
|
|
22
|
1
|
|
|
1
|
|
6
|
use warnings::register; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
152
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
487
|
use OpenFrame::WebApp::Session; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = (split(/ /, '$Revision: 1.4 $'))[1]; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use base qw ( OpenFrame::WebApp::Factory ); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub expiry { |
|
31
|
|
|
|
|
|
|
my $self = shift; |
|
32
|
|
|
|
|
|
|
if (@_) { |
|
33
|
|
|
|
|
|
|
$self->{session_expiry} = shift; |
|
34
|
|
|
|
|
|
|
return $self; |
|
35
|
|
|
|
|
|
|
} else { |
|
36
|
|
|
|
|
|
|
return $self->{session_expiry}; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub get_types_class { |
|
41
|
|
|
|
|
|
|
my $self = shift; |
|
42
|
|
|
|
|
|
|
return OpenFrame::WebApp::Session->types->{$self->type}; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new_session { |
|
46
|
|
|
|
|
|
|
my $self = shift; |
|
47
|
|
|
|
|
|
|
my $sess = $self->new_object(); |
|
48
|
|
|
|
|
|
|
$sess->expiry( $self->expiry ) if ($self->expiry); |
|
49
|
|
|
|
|
|
|
return $sess; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub fetch_session { |
|
53
|
|
|
|
|
|
|
my $self = shift; |
|
54
|
|
|
|
|
|
|
my $id = shift; |
|
55
|
|
|
|
|
|
|
$self->load_types_class->fetch( $id ); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |