| 1 | package Aion::Format::Json; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use common::sense; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use JSON::XS qw//; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 1 | ▶ | use Exporter qw/import/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | our @EXPORT = our @EXPORT_OK = grep { | ||||||||||||||||||||
| 8 | 1 | ▶ | *{$Aion::Format::Json::{$_}}{CODE} && !/^(_|(NaN|import)\z)/n | ||||||||||||||||||
|
Condition100%3/3
*{$Aion::Format::Json::{$_};}{'CODE'} && !/^(_|(NaN|import)\z)/nu
MC/DC100%2/2
*{$Aion::Format::Json::{$_};}{'CODE'} && !/^(_|(NaN|import)\z)/nu
*{$Aion::Format::Json::{$_};}{'CODE'}
!/^(_|(NaN|import)\z)/nu
Truth table100%3/3
A && not(B)
A= *{$Aion::Format::Json::{$_};}{'CODE'}B= !/^(_|(NaN|import)\z)/nu
| |||||||||||||||||||||
| 9 | } keys %Aion::Format::Json::; | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | #@category json | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | # Настраиваем json | ||||||||||||||||||||
| 14 | 1 | our $JSON = JSON::XS->new->allow_nonref->indent(1)->space_after(1)->canonical(1); | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | # В json | ||||||||||||||||||||
| 17 | 3 | ▶ | sub to_json(;$) { | ||||||||||||||||||
|
Subroutine
to_json: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 18 | 3 | ▶ | $JSON->encode(@_ == 0? $_: @_) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 19 | } | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | # Из json | ||||||||||||||||||||
| 22 | 4 | ▶ | sub from_json(;$) { | ||||||||||||||||||
|
Subroutine
from_json: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 23 | 4 | ▶ | $JSON->decode(@_ == 0? $_: @_) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 24 | } | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 1 | 1; | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | __END__ | ||||||||||||||||||||