line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sisimai::Data::JSON; |
2
|
4
|
|
|
4
|
|
1739
|
use feature ':5.10'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
348
|
|
3
|
4
|
|
|
4
|
|
22
|
use strict; |
|
4
|
|
|
|
|
17
|
|
|
4
|
|
|
|
|
83
|
|
4
|
4
|
|
|
4
|
|
18
|
use warnings; |
|
4
|
|
|
|
|
20
|
|
|
4
|
|
|
|
|
127
|
|
5
|
4
|
|
|
4
|
|
1244
|
use JSON; |
|
4
|
|
|
|
|
15249
|
|
|
4
|
|
|
|
|
27
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub dump { |
8
|
|
|
|
|
|
|
# Data dumper(JSON) |
9
|
|
|
|
|
|
|
# @param [Sisimai::Data] argvs Object |
10
|
|
|
|
|
|
|
# @return [String, Undef] Dumped data or Undef if the argument is |
11
|
|
|
|
|
|
|
# missing |
12
|
645
|
|
|
645
|
0
|
2105
|
my $class = shift; |
13
|
645
|
|
50
|
|
|
1739
|
my $argvs = shift // return undef; |
14
|
645
|
100
|
|
|
|
1786
|
return undef unless ref $argvs eq 'Sisimai::Data'; |
15
|
|
|
|
|
|
|
|
16
|
644
|
|
|
|
|
863
|
my $jsonstring = ''; |
17
|
644
|
|
|
|
|
968
|
eval { $jsonstring = JSON->new->space_after(1)->encode($argvs->damn) }; |
|
644
|
|
|
|
|
7943
|
|
18
|
644
|
50
|
|
|
|
23227
|
warn sprintf(" ***warning: Something is wrong in JSON encoding: %s", $@) if $@; |
19
|
644
|
|
|
|
|
3483
|
return $jsonstring; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
__END__ |