Zing/Encoder/Dump.pm untested

filter: Statementstmt 0.0% 0 / 40 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod n/a totaltotal 0.0% 0 / 49 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Zing::Encoder::Dump;
2  
3 use 5.014;
4  
5 use strict;
6 use warnings;
7  
8 use registry 'Zing::Types';
9 use routines;
10  
11 use Data::Object::Class;
12  
13 extends 'Zing::Encoder';
14  
15 use Data::Dumper ();
16  
17 our $VERSION = '0.26'; # VERSION
18  
19 # METHODS
20  
21 method decode(Str $data) {
22 return eval $data;
23 }
24  
25 method encode(HashRef $data) {
26 require Data::Dumper;
27  
28 no warnings 'once';
29  
30 local $Data::Dumper::Indent = 0;
31 local $Data::Dumper::Purity = 0;
32 local $Data::Dumper::Quotekeys = 0;
33 local $Data::Dumper::Deepcopy = 1;
34 local $Data::Dumper::Deparse = 1;
35 local $Data::Dumper::Sortkeys = 1;
36 local $Data::Dumper::Terse = 1;
37 local $Data::Dumper::Useqq = 1;
38  
39 return Data::Dumper::Dumper($data);
40 }
41  
42 1;
43  
44 =encoding utf8
45  
46 =head1 NAME
47  
48 Zing::Encoder::Dump - Perl Serialization Abstraction
49  
50 =cut
51  
52 =head1 ABSTRACT
53  
54 Perl Data Serialization Abstraction
55  
56 =cut
57  
58 =head1 SYNOPSIS
59  
60 use Zing::Encoder::Dump;
61  
62 my $encoder = Zing::Encoder::Dump->new;
63  
64 # $encoder->encode({ status => 'okay' });
65  
66 =cut
67  
68 =head1 DESCRIPTION
69  
70 This package provides a L<Data::Dumper|Perl> data serialization abstraction for
71 use with L<Zing::Store> stores.
72  
73 =cut
74  
75 =head1 LIBRARIES
76  
77 This package uses type constraints from:
78  
79 L<Zing::Types>
80  
81 =cut
82  
83 =head1 METHODS
84  
85 This package implements the following methods:
86  
87 =cut
88  
89 =head2 decode
90  
91 decode(Str $data) : HashRef
92  
93 The decode method decodes the data provided.
94  
95 =over 4
96  
97 =item decode example #1
98  
99 # given: synopsis
100  
101 $encoder->decode('{ "status","okay" }');
102  
103 =back
104  
105 =cut
106  
107 =head2 encode
108  
109 encode(HashRef $data) : Str
110  
111 The encode method encodes the data provided.
112  
113 =over 4
114  
115 =item encode example #1
116  
117 # given: synopsis
118  
119 $encoder->encode({ status => 'okay' });
120  
121 =back
122  
123 =cut
124  
125 =head1 AUTHOR
126  
127 Al Newkirk, C<awncorp@cpan.org>
128  
129 =head1 LICENSE
130  
131 Copyright (C) 2011-2019, Al Newkirk, et al.
132  
133 This is free software; you can redistribute it and/or modify it under the terms
134 of the The Apache License, Version 2.0, as elucidated in the L<"license
135 file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>.
136  
137 =head1 PROJECT
138  
139 L<Wiki|https://github.com/iamalnewkirk/zing/wiki>
140  
141 L<Project|https://github.com/iamalnewkirk/zing>
142  
143 L<Initiatives|https://github.com/iamalnewkirk/zing/projects>
144  
145 L<Milestones|https://github.com/iamalnewkirk/zing/milestones>
146  
147 L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md>
148  
149 L<Issues|https://github.com/iamalnewkirk/zing/issues>
150  
151 =cut