Sisimai/Fact/JSON.pm

filter: Statementstmt 100% 20 / 20 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 84.8% 28 / 33 CC 4 SCAR 9.5
CC
4
Cov
88%
dump
4.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.6
« Sisimai/Reason/VirusDetected.pm ↑ Summary Sisimai/Reason/HasMoved.pm »
1 package Sisimai::Fact::JSON;
2 82 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 82 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 82 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 82 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1499 ▶sub dump {
Subroutine dump: called CC=4 SCAR=14.2
Pod undocumented
8 # Data dumper(JSON)
9 # @param [Sisimai::Fact] argvs Object
10 # @return [String] Dumped data or an empty string if the argument is missing
11 1499 my $class = shift;
12 1499 ▶ my $argvs = shift // return ""; return "" if ref $argvs ne 'Sisimai::Fact';
Branch: 1 branch
BranchTrueFalseTotal
if ref $argvs ne "Sisimai::Fact" 0 1499 1499
Condition50%1/2
shift() // (return "")
l!l
14990
MC/DC0%0/1
shift() // (return "")
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
13  
14 1499 my $jsonstring = "";
15 1499 eval { $jsonstring = JSON->new->space_after(1)->encode($argvs->damn) };
16 1499 ▶ warn sprintf(" ***warning: Something is wrong in JSON encoding: %s", $@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1499 1499
17 1499 return $jsonstring;
18 }
19  
20 82 1;
21 __END__
« Sisimai/Reason/VirusDetected.pm ↑ Summary Sisimai/Reason/HasMoved.pm »