File Coverage

lib/App/MtAws/Glacier/Inventory/JSON.pm
Criterion Covered Total %
statement 28 28 100.0
branch 1 2 50.0
condition n/a
subroutine 9 9 100.0
pod 0 1 0.0
total 38 40 95.0


line stmt bran cond sub pod time code
1             # mt-aws-glacier - Amazon Glacier sync client
2             # Copyright (C) 2012-2014 Victor Efimov
3             # http://mt-aws.com (also http://vs-dev.com) vs@vs-dev.com
4             # License: GPLv3
5             #
6             # This file is part of "mt-aws-glacier"
7             #
8             # mt-aws-glacier is free software: you can redistribute it and/or modify
9             # it under the terms of the GNU General Public License as published by
10             # the Free Software Foundation, either version 3 of the License, or
11             # (at your option) any later version.
12             #
13             # mt-aws-glacier is distributed in the hope that it will be useful,
14             # but WITHOUT ANY WARRANTY; without even the implied warranty of
15             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16             # GNU General Public License for more details.
17             #
18             # You should have received a copy of the GNU General Public License
19             # along with this program. If not, see <http://www.gnu.org/licenses/>.
20              
21             package App::MtAws::Glacier::Inventory::JSON;
22              
23             our $VERSION = '1.114_2';
24              
25 3     3   20415 use strict;
  3         4  
  3         72  
26 3     3   9 use warnings;
  3         4  
  3         59  
27 3     3   10 use utf8;
  3         4  
  3         14  
28              
29 3     3   42 use Carp;
  3         4  
  3         162  
30 3     3   591 use JSON::XS 1.00;
  3         4619  
  3         161  
31              
32 3     3   1342 use App::MtAws::Glacier::Inventory ();
  3         4  
  3         66  
33 3     3   17 use base q{App::MtAws::Glacier::Inventory};
  3         5  
  3         510  
34              
35             sub new
36             {
37 6     6 0 19734 my $class = shift;
38 6         17 my $self = { rawdata => \$_[0] };
39 6         13 bless $self, $class;
40 6         46 $self;
41             }
42              
43             sub _parse
44             {
45 6     6   10 my ($self) = @_;
46 6 50       55 $self->{data} = JSON::XS->new->allow_nonref->utf8->decode(${ delete $self->{rawdata} || confess });
  6         117  
47             }
48              
49             1;