File Coverage

blib/lib/Data/Section/Pluggable/Plugin/Json.pm
Criterion Covered Total %
statement 27 33 81.8
branch n/a
condition n/a
subroutine 8 9 88.8
pod 0 3 0.0
total 35 45 77.7


line stmt bran cond sub pod time code
1 3     3   18 use warnings;
  3         7  
  3         226  
2 3     3   53 use 5.020;
  3         12  
3 3     3   16 use true;
  3         6  
  3         30  
4 3     3   3871 use experimental qw( signatures );
  3         6  
  3         25  
5              
6             package Data::Section::Pluggable::Plugin::Json 0.08 {
7              
8             # ABSTRACT: Data::Section::Pluggable Plugin for JSON
9              
10              
11 3     3   1538 use Role::Tiny::With;
  3         11153  
  3         201  
12 3     3   1532 use JSON::MaybeXS ();
  3         20927  
  3         785  
13              
14             with 'Data::Section::Pluggable::Role::ContentProcessorPlugin';
15             if(eval { require Data::Section::Pluggable::Role::FormatContentPlugin }) {
16             with 'Data::Section::Pluggable::Role::FormatContentPlugin';
17             }
18              
19 3     3 0 7 sub extensions ($class) {
  3         7  
  3         5  
20 3         9 return ('json');
21             }
22              
23 3     3 0 35 sub process_content ($class, $dsp, $content) {
  3         5  
  3         6  
  3         5  
  3         5  
24 3         37 JSON::MaybeXS::decode_json($content);
25             }
26              
27 0     0 0   sub format_content ($class, $dsw, $content) {
  0            
  0            
  0            
  0            
28 0           JSON::MaybeXS->new->pretty->canonical->encode($content);
29             }
30             }
31              
32             __END__