File Coverage

blib/lib/Data/Crumbr/Default/JSON.pm
Criterion Covered Total %
statement 5 5 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 9 9 100.0


line stmt bran cond sub pod time code
1             package Data::Crumbr::Default::JSON;
2             $Data::Crumbr::Default::JSON::VERSION = '0.1.0';
3             # ABSTRACT: "JSON" profile for Data::Crumbr::Default
4 2     2   1674 use Data::Crumbr::Util;
  2         5  
  2         172  
5              
6             sub profile {
7 1     1 1 3 my $json_encoder = Data::Crumbr::Util::json_leaf_encoder();
8             return {
9             hash_open => '{',
10             hash_key_prefix => '',
11             hash_key_suffix => ':',
12             hash_close => '}',
13              
14             array_open => '[',
15             array_key_prefix => '',
16             array_key_suffix => '',
17             array_close => ']',
18              
19             keys_separator => '',
20             value_separator => '',
21       6     array_key_encoder => sub { },
22 1         13 hash_key_encoder => $json_encoder,
23             value_encoder => $json_encoder,
24             };
25             } ## end sub profile
26              
27             1;
28              
29             __END__
30              
31             =pod
32              
33             =encoding utf-8
34              
35             =head1 NAME
36              
37             Data::Crumbr::Default::JSON - "JSON" profile for Data::Crumbr::Default
38              
39             =head1 VERSION
40              
41             version 0.1.0
42              
43             =head1 DESCRIPTION
44              
45             Profile for JSON encoder
46              
47             =head1 INTERFACE
48              
49             =over
50              
51             =item B<< profile >>
52              
53             my $profile = Data::Crumbr::Default::JSON->profile();
54              
55             returns a default profile, i.e. encoder data to be used to instantiate a
56             Data::Crumbr::Default encoder. See L</Data::Crumbr> for details about
57             this profile.
58              
59             =back
60              
61             =head1 AUTHOR
62              
63             Flavio Poletti <polettix@cpan.org>
64              
65             =head1 COPYRIGHT AND LICENSE
66              
67             Copyright (C) 2015 by Flavio Poletti <polettix@cpan.org>
68              
69             This module is free software. You can redistribute it and/or
70             modify it under the terms of the Artistic License 2.0.
71              
72             This program is distributed in the hope that it will be useful,
73             but without any warranty; without even the implied warranty of
74             merchantability or fitness for a particular purpose.
75              
76             =cut