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