| 1 | package Data::Encoder::JSON; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use JSON; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 3 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||
| 8 | 3 | my ($class, $args) = @_; | |||||||||||
| 9 | 3 | my $json = JSON->new; | |||||||||||
| 10 | |||||||||||||
| 11 | 3 | ▶ | $args ||= {}; | ||||||||||
|
Condition100%2/2
$args ||= {}
MC/DC100%1/1
$args ||= {}
$args
Truth table100%2/2
A
A= $args
| |||||||||||||
| 12 | 3 | for my $method (keys %$args) { | |||||||||||
| 13 | 1 | ▶ | $json->$method(defined $args->{$method} ? $args->{$method} : ()); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 14 | } | ||||||||||||
| 15 | |||||||||||||
| 16 | bless { | ||||||||||||
| 17 | 3 | json => $json, | |||||||||||
| 18 | }, __PACKAGE__; | ||||||||||||
| 19 | } | ||||||||||||
| 20 | |||||||||||||
| 21 | 3 | ▶ | sub encode { | ||||||||||
|
Subroutine
encode: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 22 | 3 | my ($self, $stuff, @args) = @_; | |||||||||||
| 23 | 3 | $self->{json}->encode($stuff, @args); | |||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | 1 | ▶ | sub decode { | ||||||||||
|
Subroutine
decode: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 27 | 1 | my ($self, $stuff, @args) = @_; | |||||||||||
| 28 | 1 | $self->{json}->decode($stuff, @args); | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 2 | 1; | |||||||||||
| 32 | __END__ | ||||||||||||