line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer2::Session::DBIC::Serializer::Sereal; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Dancer2::Session::DBIC::Serializer::Sereal |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Use L<Sereal> serialization for session storage. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
34305
|
use Sereal::Encoder; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
74
|
|
14
|
2
|
|
|
2
|
|
7
|
use Sereal::Decoder; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
45
|
|
15
|
2
|
|
|
2
|
|
439
|
use Moo; |
|
2
|
|
|
|
|
8064
|
|
|
2
|
|
|
|
|
11
|
|
16
|
|
|
|
|
|
|
with 'Dancer2::Session::DBIC::Role::Serializer'; |
17
|
2
|
|
|
2
|
|
1547
|
use namespace::clean; |
|
2
|
|
|
|
|
6238
|
|
|
2
|
|
|
|
|
11
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
See L<Dancer2::Session::DBIC::Role::Serializer> for inherited attributes. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
B<NOTE:> you must install L<Sereal::Encoder> and L<Sereal::Decoder> to use this |
24
|
|
|
|
|
|
|
serializer. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 METHODS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 serialize $perl_objects |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Serialize C<$perl_objects> to Sereal. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub serialize { |
35
|
7
|
|
|
7
|
1
|
3561
|
shift->serializer->encode(shift); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _build_serializer { |
39
|
3
|
|
|
3
|
|
579
|
Sereal::Encoder->new( shift->serialize_options ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 deserialize $sereal |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Deserialize C<$sereal> to Perl objects. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub deserialize { |
49
|
11
|
|
|
11
|
1
|
8899
|
shift->deserializer->decode(shift); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _build_deserializer { |
53
|
2
|
|
|
2
|
|
564
|
Sereal::Decoder->new( shift->deserialize_options ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |