line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kwiki::Session; |
2
|
1
|
|
|
1
|
|
1257
|
use Kwiki::Plugin -Base; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use CGI::Session; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
const class_id => 'session'; |
8
|
|
|
|
|
|
|
const class_title => 'Session'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
field session => -init => '$self->load_session()'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub load { |
13
|
|
|
|
|
|
|
$self->session |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub load_session { |
17
|
|
|
|
|
|
|
my $jar = $self->hub->cookie->read("Session"); |
18
|
|
|
|
|
|
|
my $session = CGI::Session->new(undef, $jar->{id} || undef, |
19
|
|
|
|
|
|
|
{Directory=>$self->plugin_directory}); |
20
|
|
|
|
|
|
|
$self->hub->cookie->write("Session", { id => $session->id() } ); |
21
|
|
|
|
|
|
|
return $session; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
__END__ |