line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#############################################################################
|
2
|
|
|
|
|
|
|
#
|
3
|
|
|
|
|
|
|
# Apache::Session::Serialize::Storable
|
4
|
|
|
|
|
|
|
# Serializes session objects using Storable
|
5
|
|
|
|
|
|
|
# Copyright(c) 2000 Jeffrey William Baker (jwbaker@acm.org)
|
6
|
|
|
|
|
|
|
# Distribute under the Perl License
|
7
|
|
|
|
|
|
|
#
|
8
|
|
|
|
|
|
|
############################################################################
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package Apache::Session::Serialize::Storable;
|
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
1605
|
use strict;
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
98
|
|
13
|
3
|
|
|
3
|
|
15
|
use vars qw($VERSION);
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
126
|
|
14
|
3
|
|
|
3
|
|
1979
|
use Storable qw(nfreeze thaw);
|
|
3
|
|
|
|
|
9781
|
|
|
3
|
|
|
|
|
475
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$VERSION = '1.01';
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub serialize {
|
19
|
5
|
|
|
5
|
0
|
1087
|
my $session = shift;
|
20
|
|
|
|
|
|
|
|
21
|
5
|
|
|
|
|
18
|
$session->{serialized} = nfreeze $session->{data};
|
22
|
|
|
|
|
|
|
}
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub unserialize {
|
25
|
2
|
|
|
2
|
0
|
85
|
my $session = shift;
|
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
7
|
my $data = thaw $session->{serialized};
|
28
|
2
|
50
|
|
|
|
55
|
die "Session could not be unserialized" unless defined $data;
|
29
|
|
|
|
|
|
|
#Storable can return undef or die for different errors
|
30
|
2
|
|
|
|
|
7
|
$session->{data} = $data;
|
31
|
|
|
|
|
|
|
}
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1;
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=pod
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Apache::Session::Serialize::Storable - Use Storable to zip up persistent data
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
use Apache::Session::Serialize::Storable;
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$zipped = Apache::Session::Serialize::Storable::serialize($ref);
|
46
|
|
|
|
|
|
|
$ref = Apache::Session::Serialize::Storable::unserialize($zipped);
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This module fulfills the serialization interface of Apache::Session.
|
51
|
|
|
|
|
|
|
It serializes the data in the session object by use of Storable's
|
52
|
|
|
|
|
|
|
C and C functions. The result is a binary object ready
|
53
|
|
|
|
|
|
|
for storage.
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This module was written by Jeffrey William Baker .
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SEE ALSO
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
L, L
|