| Apache-Session documentation | Contained in the Apache-Session distribution. |
Apache::Session::Serialize::UUEncode - Use Storable and pack()
to zip up persistent data
use Apache::Session::Serialize::UUEncode; $zipped = Apache::Session::Serialize::UUEncode::serialize($ref); $ref = Apache::Session::Serialize::UUEncode::unserialize($zipped);
This module fulfills the serialization interface of Apache::Session. It
serializes the data in the session object by use of Storable's nfreeze() and
thaw() functions, and Perl's pack() and unpack(). The serialized data
is ASCII text, suitable for storage in backing stores that don't handle binary
data gracefully, such as Postgres.
This module was written by Jeffrey William Baker <jwbaker@acm.org>.
| Apache-Session documentation | Contained in the Apache-Session distribution. |
############################################################################# # # Apache::Session::Serialize::UUEncode # Serializes session objects using Storable and pack # Copyright(c) 2000 Jeffrey William Baker (jwbaker@acm.org) # Distribute under the Perl License # ############################################################################ package Apache::Session::Serialize::UUEncode; use strict; use vars qw($VERSION); use Storable qw(nfreeze thaw); $VERSION = '1.01'; sub serialize { my $session = shift; $session->{serialized} = pack("u", nfreeze($session->{data})); } sub unserialize { my $session = shift; my $data = thaw(unpack("u", $session->{serialized})); die "Session could not be unserialized" unless defined $data; #Storable can return undef or die for different errors $session->{data} = $data; } 1;