| 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 | ▶ | use Sereal::Encoder; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 2 | ▶ | use Sereal::Decoder; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 2 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 2 | with 'Dancer2::Session::DBIC::Role::Serializer'; | |
| 17 | 2 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 | 7 | ▶ | sub serialize { |
|
Subroutine
serialize: called CC=1 SCAR=0.0
Pod
documented
| |||
| 35 | 7 | shift->serializer->encode(shift); | |
| 36 | } | ||
| 37 | |||
| 38 | 3 | ▶ | sub _build_serializer { |
|
Subroutine
_build_serializer: called CC=1 SCAR=0.0
| |||
| 39 | 3 | 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 | 12 | ▶ | sub deserialize { |
|
Subroutine
deserialize: called CC=1 SCAR=0.0
Pod
documented
| |||
| 49 | 12 | shift->deserializer->decode(shift); | |
| 50 | } | ||
| 51 | |||
| 52 | 2 | ▶ | sub _build_deserializer { |
|
Subroutine
_build_deserializer: called CC=1 SCAR=0.0
| |||
| 53 | 2 | Sereal::Decoder->new( shift->deserialize_options ); | |
| 54 | } | ||
| 55 | |||
| 56 | 2 | 1; | |