File Coverage

blib/lib/WebService/Geocodio/JSON.pm
Criterion Covered Total %
statement 18 22 81.8
branch n/a
condition n/a
subroutine 6 8 75.0
pod 2 2 100.0
total 26 32 81.2


line stmt bran cond sub pod time code
1 6     6   2825 use strict;
  6         12  
  6         157  
2 6     6   27 use warnings;
  6         12  
  6         245  
3              
4             package WebService::Geocodio::JSON;
5             $WebService::Geocodio::JSON::VERSION = '0.05';
6             # ABSTRACT: A JSON de/serializer class
7              
8 6     6   29 use Moo::Role;
  6         36  
  6         67  
9 6     6   2230 use strictures 2;
  6         34  
  6         270  
10 6     6   4011 use JSON;
  6         60111  
  6         28  
11 6     6   710 use Carp qw(confess);
  6         11  
  6         788  
12              
13              
14             has 'json' => (
15             is => 'ro',
16             lazy => 1,
17             default => sub { JSON->new() },
18             );
19              
20              
21             sub encode {
22 0     0 1   my ($self, $aref) = @_;
23              
24 0           return $self->json->encode($aref);
25             }
26              
27              
28             sub decode {
29 0     0 1   my ($self, $data) = @_;
30              
31 0           return $self->json->decode($data);
32             }
33              
34             1;
35              
36             __END__