| 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
Condition50%1/2
shift() // (return "")
MC/DC0%0/1
shift() // (return "")
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 17 | 1499 | return $jsonstring; | |||||||||||||||||||
| 18 | } | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 82 | 1; | |||||||||||||||||||
| 21 | __END__ | ||||||||||||||||||||