line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::WAMP::Serialization::json; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
463
|
use JSON (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use constant { |
6
|
1
|
|
|
|
|
69
|
serialization => 'json', |
7
|
|
|
|
|
|
|
websocket_data_type => 'text', |
8
|
1
|
|
|
1
|
|
4
|
}; |
|
1
|
|
|
|
|
1
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#The following have trouble dealing with anything that isn’t UTF-8; |
11
|
|
|
|
|
|
|
#but JSON must always be UTF-8, UTF-16, or UTF-32 anyway as per RFC 7159. |
12
|
|
|
|
|
|
|
#So, any application that wants to send binary data via JSON needs to use |
13
|
|
|
|
|
|
|
#Base64, hex, or some such. |
14
|
|
|
|
|
|
|
*stringify = *JSON::encode_json; |
15
|
|
|
|
|
|
|
*parse = *JSON::decode_json; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#my $_JSON; |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
#sub stringify { |
20
|
|
|
|
|
|
|
# return ($_JSON ||= JSON->new()->utf8(0))->encode($_[0]); |
21
|
|
|
|
|
|
|
#} |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
#sub parse { |
24
|
|
|
|
|
|
|
# return ($_JSON ||= JSON->new()->utf8(0))->decode($_[0]); |
25
|
|
|
|
|
|
|
#} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |