line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# WARNING: This package is deprecated. |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# See RPC::ExtDirect::Config perldoc for the description |
5
|
|
|
|
|
|
|
# of the instance-based configuration options to be used |
6
|
|
|
|
|
|
|
# instead of the former global variables in this package. |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package RPC::ExtDirect::Serialize; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
13243
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
12
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
13
|
1
|
|
|
1
|
|
3
|
no warnings 'uninitialized'; ## no critic |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
115
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
### PACKAGE GLOBAL VARIABLE ### |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
# Turn on for debugging |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
# DEPRECATED. Use `debug_serialize` or `debug` Config options instead. |
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $DEBUG; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
### PACKAGE GLOBAL VARIABLE ### |
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# Set Exception class name so it could be configured |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
# DEPRECATED. Use `exception_class_serialize` or `exception_class` |
29
|
|
|
|
|
|
|
# Config options instead. |
30
|
|
|
|
|
|
|
# |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $EXCEPTION_CLASS; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
### PUBLIC CLASS METHOD ### |
35
|
|
|
|
|
|
|
# |
36
|
|
|
|
|
|
|
# Serialize the passed data into JSON form |
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
# DEPRECATED. Use RPC::ExtDirect::Serializer->serializer instance method |
39
|
|
|
|
|
|
|
# instead. |
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub serialize { |
43
|
|
|
|
|
|
|
# Class name |
44
|
0
|
|
|
0
|
0
|
|
shift; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $mute_exceptions = shift; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
warn __PACKAGE__.'->serialize class method is deprecated; ' . |
49
|
|
|
|
|
|
|
'use RPC::ExtDirect::Serializer->serialize ' . |
50
|
|
|
|
|
|
|
'instance method instead'; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
require RPC::ExtDirect::Config; |
53
|
0
|
|
|
|
|
|
require RPC::ExtDirect::Serializer; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $config = RPC::ExtDirect::Config->new(); |
56
|
0
|
|
|
|
|
|
my $serializer = RPC::ExtDirect::Serializer->new( config => $config ); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $serializer->serialize( |
59
|
|
|
|
|
|
|
mute_exceptions => $mute_exceptions, |
60
|
|
|
|
|
|
|
data => [ @_ ], |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |