| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Template::Plugin::Session; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
125618
|
use Apache::Session::Flex; |
|
|
2
|
|
|
|
|
7365
|
|
|
|
2
|
|
|
|
|
65
|
|
|
4
|
2
|
|
|
2
|
|
1892
|
use Template::Plugin; |
|
|
2
|
|
|
|
|
530962
|
|
|
|
2
|
|
|
|
|
69
|
|
|
5
|
2
|
|
|
2
|
|
18
|
use vars qw( $VERSION ); |
|
|
2
|
|
|
|
|
10
|
|
|
|
2
|
|
|
|
|
126
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use base qw( Template::Plugin ); |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
158
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1072
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = '0.01'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
|
12
|
1
|
|
|
1
|
1
|
42
|
my ($class, $context, $id, @args) = @_; |
|
13
|
1
|
|
|
|
|
3
|
my %session; |
|
14
|
1
|
|
|
|
|
1
|
eval { |
|
15
|
1
|
50
|
|
|
|
13
|
tie %session, 'Apache::Session::Flex', $id, ( ref $args[0] ? $args[0] : {@args} ); |
|
16
|
|
|
|
|
|
|
}; |
|
17
|
1
|
50
|
|
|
|
26404
|
$context->throw('Session',"Can't create/restore session with id '$id'") if $@; |
|
18
|
1
|
|
|
|
|
17
|
bless { |
|
19
|
|
|
|
|
|
|
_CONTEXT => $context, |
|
20
|
|
|
|
|
|
|
session => \%session, |
|
21
|
|
|
|
|
|
|
}, $class; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub get { |
|
25
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
26
|
0
|
0
|
|
|
|
0
|
my @args = ref($_[0]) eq 'ARRAY' ? @{$_[0]} : @_; |
|
|
0
|
|
|
|
|
0
|
|
|
27
|
0
|
0
|
|
|
|
0
|
if ( ! @args ) { |
|
28
|
0
|
|
|
|
|
0
|
@args = keys %{$self->{session}}; |
|
|
0
|
|
|
|
|
0
|
|
|
29
|
|
|
|
|
|
|
} |
|
30
|
0
|
|
|
|
|
0
|
my @ary; |
|
31
|
0
|
|
|
|
|
0
|
foreach ( @args ) { |
|
32
|
0
|
|
|
|
|
0
|
push @ary, $self->{session}->{$_}; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
0
|
|
|
|
|
0
|
return @ary; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub set { |
|
38
|
1
|
|
|
1
|
1
|
64
|
my ($self, @args) = @_; |
|
39
|
1
|
50
|
33
|
|
|
12
|
my $config = @args && ref $args[-1] eq 'HASH' ? pop(@args) : {}; |
|
40
|
1
|
|
|
|
|
5
|
foreach ( keys %$config ) { |
|
41
|
|
|
|
|
|
|
# to avoid ovverride _session_id special key |
|
42
|
1
|
50
|
|
|
|
8
|
next if /^_session_di$/; |
|
43
|
1
|
|
|
|
|
21
|
$self->{session}->{$_} = $config->{$_}; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
1
|
|
|
|
|
18
|
return ''; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub delete { |
|
49
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
50
|
0
|
0
|
|
|
|
|
my @args = ref($_[0]) eq 'ARRAY' ? @{$_[0]} : @_; |
|
|
0
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
foreach ( @args ) { |
|
52
|
|
|
|
|
|
|
# to avoid ovverride _session_id special key |
|
53
|
0
|
0
|
|
|
|
|
next if /^_session_id$/; |
|
54
|
0
|
|
|
|
|
|
delete $self->{session}->{$_}; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
0
|
|
|
|
|
|
return ''; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub destroy { |
|
60
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
61
|
0
|
|
|
|
|
|
tied(%{$self->{session}})->delete; |
|
|
0
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
|
65
|
|
|
|
|
|
|
__END__ |