line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Clean::FromJSON::Pregen; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2019-09-08'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
55653
|
use 5.010001; |
|
1
|
|
|
|
|
10
|
|
7
|
1
|
|
|
1
|
|
13
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
8
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
98
|
use Exporter qw(import); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
406
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
12
|
|
|
|
|
|
|
clean_from_json_in_place |
13
|
|
|
|
|
|
|
clone_and_clean_from_json |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _clone { |
17
|
0
|
0
|
|
0
|
|
0
|
if (eval { require Data::Clone; 1 }) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
18
|
0
|
|
|
|
|
0
|
Data::Clone::clone(@_); |
19
|
|
|
|
|
|
|
} else { |
20
|
0
|
|
|
|
|
0
|
require Clone::PP; |
21
|
0
|
|
|
|
|
0
|
Clone::PP::clone(@_); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# generated with Data::Clean version 0.505, Data::Clean::FromJSON version 0.394 |
26
|
|
|
|
|
|
|
sub clean_from_json_in_place { |
27
|
1
|
|
|
1
|
1
|
964
|
my $data = shift; |
28
|
1
|
|
|
|
|
1
|
state $process_array; |
29
|
1
|
|
|
|
|
2
|
state $process_hash; |
30
|
1
|
50
|
|
1
|
|
4
|
if (!$process_array) { $process_array = sub { my $a = shift; for my $e (@$a) { my $ref=ref($e); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
5
|
|
31
|
2
|
100
|
|
|
|
4
|
if ($ref eq 'JSON::PP::Boolean') { $e = ${ $e } ? 1:0; $ref = '' } |
|
2
|
50
|
|
|
|
3
|
|
|
2
|
|
|
|
|
22
|
|
|
2
|
|
|
|
|
4
|
|
32
|
2
|
50
|
|
|
|
7
|
if ($ref eq 'ARRAY') { $process_array->($e) } |
|
0
|
50
|
|
|
|
0
|
|
33
|
0
|
|
|
|
|
0
|
elsif ($ref eq 'HASH') { $process_hash->($e) } |
34
|
1
|
|
|
|
|
4
|
} } } |
35
|
1
|
50
|
|
0
|
|
3
|
if (!$process_hash) { $process_hash = sub { my $h = shift; for my $k (keys %$h) { my $ref=ref($h->{$k}); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
36
|
0
|
0
|
|
|
|
0
|
if ($ref eq 'JSON::PP::Boolean') { $h->{$k} = ${ $h->{$k} } ? 1:0; $ref = '' } |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
37
|
0
|
0
|
|
|
|
0
|
if ($ref eq 'ARRAY') { $process_array->($h->{$k}) } |
|
0
|
0
|
|
|
|
0
|
|
38
|
0
|
|
|
|
|
0
|
elsif ($ref eq 'HASH') { $process_hash->($h->{$k}) } |
39
|
1
|
|
|
|
|
3
|
} } } |
40
|
1
|
|
|
|
|
2
|
for ($data) { my $ref=ref($_); |
|
1
|
|
|
|
|
2
|
|
41
|
1
|
0
|
|
|
|
4
|
if ($ref eq 'JSON::PP::Boolean') { $_ = ${ $_ } ? 1:0; $ref = '' } |
|
0
|
50
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
42
|
1
|
50
|
|
|
|
3
|
if ($ref eq 'ARRAY') { $process_array->($_) } |
|
1
|
0
|
|
|
|
2
|
|
43
|
0
|
|
|
|
|
0
|
elsif ($ref eq 'HASH') { $process_hash->($_) } |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
$data |
46
|
1
|
|
|
|
|
2
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub clone_and_clean_from_json { |
50
|
0
|
|
|
0
|
1
|
|
my $data = _clone(shift); |
51
|
0
|
|
|
|
|
|
clean_from_json_in_place($data); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
# ABSTRACT: Clean data from JSON encoder |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |