| 1 | package Dancer2::Session::DBIC::Role::Serializer; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Dancer2::Session::DBIC::Role::Serializer - role consumed by all serializers | ||
| 6 | |||
| 7 | =cut | ||
| 8 | |||
| 9 | 4 | ▶ | use Dancer2::Core::Types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 4 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 4 | requires 'serialize', 'deserialize', '_build_serializer', '_build_deserializer'; | |
| 12 | |||
| 13 | =head2 METHODS REQUIRED | ||
| 14 | |||
| 15 | The following methods must be provided by any class which consumes this role: | ||
| 16 | |||
| 17 | =over | ||
| 18 | |||
| 19 | =item * serialize | ||
| 20 | |||
| 21 | =item * deserialize | ||
| 22 | |||
| 23 | =item * _build_serializer | ||
| 24 | |||
| 25 | =item * _build_deserializer | ||
| 26 | |||
| 27 | =back | ||
| 28 | |||
| 29 | =head1 ATTRIBUTES | ||
| 30 | |||
| 31 | =head2 serialize_options | ||
| 32 | |||
| 33 | Options to be passed to the constructor of the underlying serializer class | ||
| 34 | as a hash reference. | ||
| 35 | |||
| 36 | Defaults to an empty hash reference. | ||
| 37 | |||
| 38 | =cut | ||
| 39 | |||
| 40 | has serialize_options => ( | ||
| 41 | is => 'ro', | ||
| 42 | isa => HashRef, | ||
| 43 | 1 | ▶ | default => sub { {} }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 44 | 4 | ); | |
| 45 | |||
| 46 | =head2 deserialize_options | ||
| 47 | |||
| 48 | Options to be passed to the constructor of the underlying deserializer class | ||
| 49 | as a hash reference. | ||
| 50 | |||
| 51 | Defaults to an empty hash reference. | ||
| 52 | |||
| 53 | =cut | ||
| 54 | |||
| 55 | has deserialize_options => ( | ||
| 56 | is => 'ro', | ||
| 57 | isa => HashRef, | ||
| 58 | 6 | ▶ | default => sub { {} }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 59 | 4 | ); | |
| 60 | |||
| 61 | =head2 serializer | ||
| 62 | |||
| 63 | Vivified serializer. | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | 4 | has serializer => ( | |
| 68 | is => 'lazy', | ||
| 69 | isa => Object, | ||
| 70 | ); | ||
| 71 | |||
| 72 | =head2 deserializer | ||
| 73 | |||
| 74 | Vivified deserializer. | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | 4 | has deserializer => ( | |
| 79 | is => 'lazy', | ||
| 80 | isa => Object, | ||
| 81 | ); | ||
| 82 | |||
| 83 | 4 | 1; | |