| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Message::Passing::Filter::Decoder::JSON; |
|
2
|
4
|
|
|
4
|
|
4851
|
use Moo; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
27
|
|
|
3
|
4
|
|
|
4
|
|
3008
|
use JSON::MaybeXS qw( decode_json ); |
|
|
4
|
|
|
|
|
556
|
|
|
|
4
|
|
|
|
|
271
|
|
|
4
|
4
|
|
|
4
|
|
23
|
use Try::Tiny; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
213
|
|
|
5
|
4
|
|
|
4
|
|
2310
|
use Message::Passing::Exception::Decoding; |
|
|
4
|
|
|
|
|
19
|
|
|
|
4
|
|
|
|
|
152
|
|
|
6
|
4
|
|
|
4
|
|
26
|
use namespace::clean -except => 'meta'; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with qw/ |
|
9
|
|
|
|
|
|
|
Message::Passing::Role::Filter |
|
10
|
|
|
|
|
|
|
Message::Passing::Role::HasErrorChain |
|
11
|
|
|
|
|
|
|
/; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub filter { |
|
14
|
4
|
|
|
4
|
1
|
7
|
my ($self, $message) = @_; |
|
15
|
|
|
|
|
|
|
try { |
|
16
|
4
|
100
|
|
4
|
|
196
|
ref($message) ? $message : decode_json( $message ) |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
catch { |
|
19
|
1
|
|
|
1
|
|
11
|
$self->error->consume(Message::Passing::Exception::Decoding->new( |
|
20
|
|
|
|
|
|
|
exception => $_, |
|
21
|
|
|
|
|
|
|
packed_data => $message, |
|
22
|
|
|
|
|
|
|
)); |
|
23
|
1
|
|
|
|
|
34
|
return; # Explicit return undef |
|
24
|
4
|
|
|
|
|
36
|
}; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Message::Passing::Role::Filter::Decoder::JSON |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Decodes string messages from JSON into data structures. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 METHODS |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 filter |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
JSON decodes a message supplied as a parameter. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=over |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item L |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item L |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=back |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SPONSORSHIP |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This module exists due to the wonderful people at Suretec Systems Ltd. |
|
58
|
|
|
|
|
|
|
who sponsored its development for its |
|
59
|
|
|
|
|
|
|
VoIP division called SureVoIP for use with |
|
60
|
|
|
|
|
|
|
the SureVoIP API - |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT AND LICENSE |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
See L. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
|
68
|
|
|
|
|
|
|
|