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