line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Message::Passing::Filter::Decoder::JSON; |
2
|
4
|
|
|
4
|
|
4304
|
use Moo; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
29
|
|
3
|
4
|
|
|
4
|
|
2231
|
use JSON::MaybeXS qw( decode_json ); |
|
4
|
|
|
|
|
844
|
|
|
4
|
|
|
|
|
358
|
|
4
|
4
|
|
|
4
|
|
29
|
use Try::Tiny; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
289
|
|
5
|
4
|
|
|
4
|
|
2277
|
use Message::Passing::Exception::Decoding; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
215
|
|
6
|
4
|
|
|
4
|
|
35
|
use namespace::clean -except => 'meta'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
29
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with qw/ |
9
|
|
|
|
|
|
|
Message::Passing::Role::Filter |
10
|
|
|
|
|
|
|
Message::Passing::Role::HasErrorChain |
11
|
|
|
|
|
|
|
/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub filter { |
14
|
4
|
|
|
4
|
1
|
10
|
my ($self, $message) = @_; |
15
|
|
|
|
|
|
|
try { |
16
|
4
|
100
|
|
4
|
|
256
|
ref($message) ? $message : decode_json( $message ) |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
catch { |
19
|
1
|
|
|
1
|
|
22
|
$self->error->consume(Message::Passing::Exception::Decoding->new( |
20
|
|
|
|
|
|
|
exception => $_, |
21
|
|
|
|
|
|
|
packed_data => $message, |
22
|
|
|
|
|
|
|
)); |
23
|
1
|
|
|
|
|
50
|
return; # Explicit return undef |
24
|
4
|
|
|
|
|
48
|
}; |
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
|
|
|
|
|
|
|
|