File Coverage

blib/lib/WWW/Snooze/Serialize/JSON.pm
Criterion Covered Total %
statement 12 18 66.6
branch n/a
condition n/a
subroutine 4 6 66.6
pod 3 3 100.0
total 19 27 70.3


line stmt bran cond sub pod time code
1             package WWW::Snooze::Serialize::JSON;
2              
3 3     3   18 use base 'WWW::Snooze::Serialize';
  3         4  
  3         1733  
4              
5 3     3   26 use strict;
  3         5  
  3         160  
6 3     3   17 use warnings;
  3         5  
  3         494  
7              
8             sub new {
9 5     5 1 10 my $class = shift;
10 5         10 my %args = @_;
11              
12 5         77 bless {
13             extension => 'json',
14             mime => 'application/json',
15             %args
16             }, $class;
17             }
18              
19             sub encode {
20 0     0 1   my ($self, $input) = @_;
21 0           my $output = JSON->new->allow_nonref->encode($input);
22 0           return $output;
23             }
24              
25             sub decode {
26 0     0 1   my ($self, $input) = @_;
27 0           my $output = JSON->new->allow_nonref->decode($input);
28 0           return $output;
29             }
30              
31             1;