line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Session::Serialization::Storable; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2884
|
use 5.006; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
91
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
78
|
|
5
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
91
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1571
|
use Storable qw(freeze thaw); |
|
2
|
|
|
|
|
7258
|
|
|
2
|
|
|
|
|
453
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
WWW::Session::Serialization::Storable - Serialization module for WWW::Session with Storable backend |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Storable serialization engine for WWW::Session objects |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Version 0.11 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This module handles serialization for WWW::Session objects using Storable. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This module can serialize complex structures wich contain objects. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
The object implements two main methods : serialize() and expand() |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use WWW::Session::Serialization::Storable; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $foo = WWW::Session::Serialization::Storable->new(); |
37
|
|
|
|
|
|
|
... |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$string = $serializer->serialize($structure); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
... |
42
|
|
|
|
|
|
|
$structure = $serializer->expand($string); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 new |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Creates a new WWW::Session::Serialization::Storable object |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Usage : |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $serializer = WWW::Session::Serialization::Storable->new(); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
No arguments required. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub new { |
59
|
1
|
|
|
1
|
1
|
682
|
my $class = shift; |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
2
|
my $self = {}; |
62
|
|
|
|
|
|
|
|
63
|
1
|
|
|
|
|
3
|
bless $self,$class; |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
2
|
return $self; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 serialize |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Serializes a structure and returns a binary string containing all the data |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub serialize { |
75
|
1
|
|
|
1
|
1
|
25
|
my ($self,$data) = @_; |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
4
|
return freeze($data); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 expand |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Deserializes binary string and returns a structure containing all the data |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
sub expand { |
87
|
1
|
|
|
1
|
1
|
85
|
my ($self,$string) = @_; |
88
|
|
|
|
|
|
|
|
89
|
1
|
|
|
|
|
2
|
return thaw($string); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
=head1 AUTHOR |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Gligan Calin Horea, C<< >> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 BUGS |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
98
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
99
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SUPPORT |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
perldoc WWW::Session::Serialization::Storable |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
You can also look for information at: |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=over 4 |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * CPAN Ratings |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * Search CPAN |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
L |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=back |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Copyright 2012 Gligan Calin Horea. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
142
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
143
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
1; # End of WWW::Session::Serialization::Storable |