line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBI::Gofer::Serializer::Storable; |
2
|
|
|
|
|
|
|
|
3
|
52
|
|
|
52
|
|
210
|
use strict; |
|
52
|
|
|
|
|
64
|
|
|
52
|
|
|
|
|
1632
|
|
4
|
52
|
|
|
52
|
|
204
|
use warnings; |
|
52
|
|
|
|
|
55
|
|
|
52
|
|
|
|
|
1258
|
|
5
|
|
|
|
|
|
|
|
6
|
52
|
|
|
52
|
|
187
|
use base qw(DBI::Gofer::Serializer::Base); |
|
52
|
|
|
|
|
62
|
|
|
52
|
|
|
|
|
18772
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# $Id: Storable.pm 15585 2013-03-22 20:31:22Z Tim $ |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# Copyright (c) 2007, Tim Bunce, Ireland |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# You may distribute under the terms of either the GNU General Public |
13
|
|
|
|
|
|
|
# License or the Artistic License, as specified in the Perl README file. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
DBI::Gofer::Serializer::Storable - Gofer serialization using Storable |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$serializer = DBI::Gofer::Serializer::Storable->new(); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$string = $serializer->serialize( $data ); |
24
|
|
|
|
|
|
|
($string, $deserializer_class) = $serializer->serialize( $data ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$data = $serializer->deserialize( $string ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Uses Storable::nfreeze() to serialize and Storable::thaw() to deserialize. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
The serialize() method sets local $Storable::forgive_me = 1; so it doesn't |
33
|
|
|
|
|
|
|
croak if it encounters any data types that can't be serialized, such as code refs. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
See also L. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
52
|
|
|
52
|
|
19621
|
use Storable qw(nfreeze thaw); |
|
52
|
|
|
|
|
85572
|
|
|
52
|
|
|
|
|
4212
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
our $VERSION = "0.015586"; |
42
|
|
|
|
|
|
|
|
43
|
52
|
|
|
52
|
|
275
|
use base qw(DBI::Gofer::Serializer::Base); |
|
52
|
|
|
|
|
71
|
|
|
52
|
|
|
|
|
5463
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub serialize { |
47
|
10589
|
|
|
10589
|
0
|
10947
|
my $self = shift; |
48
|
10589
|
|
|
|
|
13423
|
local $Storable::forgive_me = 1; # for CODE refs etc |
49
|
10589
|
|
|
|
|
12091
|
local $Storable::canonical = 1; # for go_cache |
50
|
10589
|
|
|
|
|
25458
|
my $frozen = nfreeze(shift); |
51
|
10589
|
50
|
|
|
|
686212
|
return $frozen unless wantarray; |
52
|
10589
|
|
|
|
|
35078
|
return ($frozen, $self->{deserializer_class}); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub deserialize { |
56
|
10575
|
|
|
10575
|
0
|
11314
|
my $self = shift; |
57
|
10575
|
|
|
|
|
25154
|
return thaw(shift); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |