DBIC/Serializer/YAML.pm

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 100% 2 / 2 totaltotal 100% 37 / 37 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« DBIC/Serializer/Sereal.pm ↑ Summary
1 package Dancer2::Session::DBIC::Serializer::YAML;
2  
3 =head1 NAME
4  
5 Dancer2::Session::DBIC::Serializer::YAML
6  
7 =head1 DESCRIPTION
8  
9 Use YAML serialization for session storage.
10  
11 B<NOTE:> you must install L<YAML> version >= 1.15 to use this serializer.
12  
13 =cut
14  
15 2 ▶use YAML 1.15 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use YAML::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶use YAML::Loader;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 with 'Dancer2::Session::DBIC::Role::Serializer';
20 2 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 =head1 ATTRIBUTES
23  
24 See L<Dancer2::Session::DBIC::Role::Serializer> for inherited attributes.
25  
26 =head2 serialize_options
27  
28 Override default with the following options:
29  
30 =over
31  
32 =item indent_width => 1
33  
34 =back
35  
36 =cut
37  
38 has '+serialize_options' => (
39 1 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
40 1 { indent_width => 1 };
41 },
42 2 );
43  
44 =head1 METHODS
45  
46 =head2 serialize $perl_objects
47  
48 Serialize C<$perl_objects> to YAML using L<YAML::Dumper>.
49  
50 =cut
51  
52 7 ▶sub serialize {
Subroutine serialize: called CC=1 SCAR=0.0
Pod documented
53 7 shift->serializer->dump(shift);
54 }
55  
56 3 ▶sub _build_serializer {
Subroutine _build_serializer: called CC=1 SCAR=0.0
57 3 YAML::Dumper->new( %{ shift->serialize_options } );
58 }
59  
60 =head2 deserialize $yaml
61  
62 Deserialize C<$yaml> to Perl objects using L<YAML::Loader>.
63  
64 =cut
65  
66 12 ▶sub deserialize {
Subroutine deserialize: called CC=1 SCAR=0.0
Pod documented
67 12 shift->deserializer->load(shift);
68 }
69  
70 2 ▶sub _build_deserializer {
Subroutine _build_deserializer: called CC=1 SCAR=0.0
71 2 YAML::Loader->new( %{ shift->deserialize_options } );
72 }
73  
74 2 1;
« DBIC/Serializer/Sereal.pm ↑ Summary