line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tak::Role::ObjectMangling; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
839
|
use Scalar::Util qw(weaken); |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
78
|
|
|
1
|
|
|
|
|
202
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
58
|
|
4
|
1
|
|
|
1
|
|
8
|
use JSON::PP qw(encode_json decode_json); |
|
1
|
|
|
1
|
|
3
|
|
|
1
|
|
|
|
|
57
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
45
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use Moo::Role; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
requires 'inflate'; |
9
|
|
|
|
|
|
|
requires 'deflate'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has encoder_json => (is => 'lazy'); |
12
|
|
|
|
|
|
|
has decoder_json => (is => 'lazy'); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _build_encoder_json { |
15
|
0
|
|
|
0
|
|
|
JSON::PP->new->allow_nonref(1)->convert_blessed(1); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _build_decoder_json { |
19
|
0
|
|
|
0
|
|
|
my $self = shift; |
20
|
0
|
|
|
|
|
|
weaken($self); |
21
|
|
|
|
|
|
|
JSON::PP->new->allow_nonref(1)->filter_json_single_key_object( |
22
|
0
|
|
|
0
|
|
|
__proxied_object__ => sub { $self->inflate($_[0]) } |
23
|
0
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub encode_objects { |
27
|
0
|
|
|
0
|
|
|
my ($self, $data) = @_; |
28
|
0
|
|
|
0
|
|
|
local *UNIVERSAL::TO_JSON = sub { $self->deflate($_[0]) }; |
|
0
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
decode_json($self->encoder_json->encode($data)); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub decode_objects { |
33
|
0
|
|
|
0
|
|
|
my ($self, $data) = @_; |
34
|
0
|
|
|
|
|
|
$self->decoder_json->decode(encode_json($data)); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|