blib/lib/Catmandu/Serializer/json.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 91.6% 22 / 24 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Catmandu/Fix/split_field.pm ↑ Summary blib/lib/Catmandu/Exporter/Mock.pm »
1 package Catmandu::Serializer::json;
2  
3 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.0201_02';
6  
7 1 ▶use Cpanel::JSON::XS ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub serialize {
12 1 ▶ Cpanel::JSON::XS::encode_json($_[1]);
Subroutine serialize: called CC=1 SCAR=0.0
Pod undocumented
13 }
14  
15 sub deserialize {
16 1 ▶ Cpanel::JSON::XS::decode_json($_[1]);
Subroutine deserialize: called CC=1 SCAR=0.0
Pod undocumented
17 }
18  
19 1 1;
20  
21 __END__
22  
23 =pod
24  
25 =head1 NAME
26  
27 Catmandu::Serializer - A (de)serializer from and to json
28  
29 =head1 SYNOPSIS
30  
31 package MyPackage;
32  
33 use Moo;
34  
35 with 'Catmandu::Serializer';
36
37 # You have now serialize and deserialize methods available
38  
39 package main;
40  
41 my $obj = MyPackage->new;
42 my $obj = MyPackage->new(serializer => 'json');
43  
44 $obj->serialize( { foo => 'bar' } ); # JSON
45 $obj->deserialize( "{'foo':'bar'}" ); # Perl
46  
47 =head1 SEE ALSO
48  
49 L<Catmandu::Serializer>
50  
51 =cut
« blib/lib/Catmandu/Fix/split_field.pm ↑ Summary blib/lib/Catmandu/Exporter/Mock.pm »