| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | package KiokuDB::Backend::Serialize::Delegate; | ||
| 4 | 21 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 21 | ▶ | use KiokuDB::Serializer; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 21 | ▶ | use namespace::clean -except => 'meta'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | #with qw(KiokuDB::Backend::Serialize); | ||
| 11 | |||
| 12 | 21 | has serializer => ( | |
| 13 | does => "KiokuDB::Backend::Serialize", | ||
| 14 | is => "ro", | ||
| 15 | coerce => 1, | ||
| 16 | default => "storable", | ||
| 17 | handles => [qw(serialize deserialize)], | ||
| 18 | ); | ||
| 19 | |||
| 20 | 21 | __PACKAGE__ | |
| 21 | |||
| 22 | __END__ | ||
| 23 | |||
| 24 | =pod | ||
| 25 | |||
| 26 | =head1 NAME | ||
| 27 | |||
| 28 | KiokuDB::Backend::Serialize::Delegate - Use a L<KiokuDB::Serializer> object | ||
| 29 | instead of a role to handle serialization in a backend. | ||
| 30 | |||
| 31 | =head1 SYNOPSIS | ||
| 32 | |||
| 33 | package MyBackend; | ||
| 34 | use Moose; | ||
| 35 | |||
| 36 | with qw( | ||
| 37 | ... | ||
| 38 | KiokuDB::Backend::Serialize::Delegate | ||
| 39 | ); | ||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | MyBackend->new( | ||
| 44 | serializer => "yaml", | ||
| 45 | ); | ||
| 46 | |||
| 47 | =head1 DESCRIPTION | ||
| 48 | |||
| 49 | This role provides a C<serialzier> attribute (by default | ||
| 50 | L<KiokuDB::Serializer::Storable>) with coercions from a moniker string for easy | ||
| 51 | serialization format selection. | ||
| 52 | |||