File Coverage

blib/lib/KiokuDB/Backend/Serialize/JSPON.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 22 22 100.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             package KiokuDB::Backend::Serialize::JSPON;
4 6     6   123461 use Moose::Role;
  6         247932  
  6         34  
5              
6 6     6   27125 use KiokuDB::Backend::Serialize::JSPON::Expander;
  6         21  
  6         235  
7 6     6   3508 use KiokuDB::Backend::Serialize::JSPON::Collapser;
  6         19  
  6         245  
8              
9 6     6   52 use namespace::clean -except => 'meta';
  6         13  
  6         56  
10              
11             with qw(
12             KiokuDB::Backend::TypeMap::Default::JSON
13             KiokuDB::Backend::Serialize::JSPON::Converter
14             );
15              
16             has expander => (
17             isa => "KiokuDB::Backend::Serialize::JSPON::Expander",
18             is => "rw",
19             lazy_build => 1,
20             handles => [qw(expand_jspon)],
21             );
22              
23             sub _build_expander {
24 19     19   35 my $self = shift;
25              
26 19         583 KiokuDB::Backend::Serialize::JSPON::Expander->new($self->_jspon_params);
27             }
28              
29             has collapser => (
30             isa => "KiokuDB::Backend::Serialize::JSPON::Collapser",
31             is => "rw",
32             lazy_build => 1,
33             handles => [qw(collapse_jspon)],
34             );
35              
36             sub _build_collapser {
37 19     19   30 my $self = shift;
38              
39 19         621 KiokuDB::Backend::Serialize::JSPON::Collapser->new($self->_jspon_params);
40             }
41              
42             __PACKAGE__
43              
44             __END__
45              
46             =pod
47              
48             =head1 NAME
49              
50             KiokuDB::Backend::Serialize::JSPON - JSPON serialization helper
51              
52             =head1 SYNOPSIS
53              
54             with qw(KiokuDB::Backend::Serialize::JSPON);
55              
56             =head1 DESCRIPTION
57              
58             This serialization role provides JSPON semantics for L<KiokuDB::Entry> and
59             L<KiokuDB::Reference> objects.
60              
61             For serialization to JSON strings see L<KiokuDB::Backend::Serialize::JSON>.
62              
63             =head1 METHODS
64              
65             =over 4
66              
67             =item expand_jspon
68              
69             See L<KiokuDB::Backend::Serialize::JSPON::Expander/expand_jspon>
70              
71             =item collapse_jspon
72              
73             See L<KiokuDB::Backend::Serialize::JSPON::Collapser/collapse_jspon>
74              
75             =back
76              
77             =cut
78              
79