File Coverage

blib/lib/Apache/Session/Serialize/Storable.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 18 20 90.0


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 Artistic License
7             #
8             ############################################################################
9              
10             package Apache::Session::Serialize::Storable;
11              
12 2     2   26 use strict;
  2         20  
  2         29  
13 2     2   31 use vars qw($VERSION);
  2         19  
  2         31  
14 2     2   33 use Storable qw(nfreeze thaw);
  2         18  
  2         115  
15              
16             $VERSION = '1.00';
17              
18             sub serialize {
19 3     3 0 29     my $session = shift;
20                 
21 3         57     $session->{serialized} = nfreeze $session->{data};
22             }
23              
24             sub unserialize {
25 2     2 0 22     my $session = shift;
26                 
27 2         43     $session->{data} = thaw $session->{serialized};
28             }
29              
30             1;
31              
32             =pod
33            
34             =head1 NAME
35            
36             Apache::Session::Serialize::Storable - Use Storable to zip up persistent data
37            
38             =head1 SYNOPSIS
39            
40             use Apache::Session::Serialize::Storable;
41            
42             $zipped = Apache::Session::Serialize::Storable::serialize($ref);
43             $ref = Apache::Session::Serialize::Storable::unserialize($zipped);
44            
45             =head1 DESCRIPTION
46            
47             This module fulfills the serialization interface of Apache::Session.
48             It serializes the data in the session object by use of Storable's
49             C<nfreeze()> and C<thaw()> functions. The result is a binary object ready
50             for storage.
51            
52             =head1 AUTHOR
53            
54             This module was written by Jeffrey William Baker <jwbaker@acm.org>.
55            
56             =head1 SEE ALSO
57            
58             L<Apache::Session::Serialize::Base64>, L<Apache::Session>
59