File Coverage

blib/lib/RPC/ExtDirect/Deserialize.pm
Criterion Covered Total %
statement 9 25 36.0
branch n/a
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 12 32 37.5


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::Deserialize;
10              
11 1     1   475 use strict;
  1         1  
  1         21  
12 1     1   3 use warnings;
  1         1  
  1         24  
13 1     1   7 no warnings 'uninitialized'; ## no critic
  1         1  
  1         193  
14              
15             ### PACKAGE GLOBAL VARIABLE ###
16             #
17             # Set it to true value to turn on debugging
18             #
19             # DEPRECATED. Use `debug_deserialize` 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_deserialize` or `exception_class`
29             # Config options instead.
30             #
31              
32             our $EXCEPTION_CLASS;
33              
34             ### PACKAGE GLOBAL VARIABLE ###
35             #
36             # Set Request class name so it could be configured
37             #
38             # DEPRECATED. Use `request_class_deserialize` or `request_class`
39             # Config options instead.
40             #
41              
42             our $REQUEST_CLASS;
43              
44             ### PACKAGE GLOBAL VARIABLE ###
45             #
46             # JSON decoding options
47             #
48             # DEPRECATED. Use `json_options_deserialize` or `json_options`
49             # Config options instead.
50             #
51              
52             our %JSON_OPTIONS;
53              
54             ### PUBLIC CLASS METHOD ###
55             #
56             # Turns JSONified POST request(s) into array of instantiated
57             # RPC::ExtDirect::Request (Exception) objects. Returns reference
58             # to array.
59             #
60             # DEPRECATED. Use RPC::ExtDirect::Serializer->decode_post() instead.
61             #
62              
63             sub decode_post {
64 0     0 0   shift; # class name
65            
66 0           my $post_text = shift;
67            
68 0           warn __PACKAGE__.'->decode_post class method is deprecated; ' .
69             'use RPC::ExtDirect::Serializer->decode_post ' .
70             'instance method instead';
71            
72 0           require RPC::ExtDirect::Config;
73 0           require RPC::ExtDirect::Serializer;
74            
75 0           my $config = RPC::ExtDirect::Config->new();
76 0           my $serializer = RPC::ExtDirect::Serializer->new( config => $config );
77            
78 0           return $serializer->decode_post(
79             data => $post_text,
80             @_
81             );
82             }
83              
84             ### PUBLIC CLASS METHOD ###
85             #
86             # Instantiates Request based on form submitted to ExtDirect handler
87             # Returns arrayref with single Request.
88             #
89             # DEPRECATED. Use RPC::ExtDirect::Serializer->decode_form() instead.
90             #
91              
92             sub decode_form {
93 0     0 0   shift; # class name
94            
95 0           my $form_href = shift;
96            
97 0           warn __PACKAGE__.'->decode_form class method is deprecated; ' .
98             'use RPC::ExtDirect::Serializer->decode_form ' .
99             'instance method instead';
100            
101 0           require RPC::ExtDirect::Config;
102 0           require RPC::ExtDirect::Serializer;
103            
104 0           my $config = RPC::ExtDirect::Config->new();
105 0           my $serializer = RPC::ExtDirect::Serializer->new( config => $config );
106            
107 0           return $serializer->decode_form(
108             data => $form_href,
109             @_
110             );
111             }
112              
113             1;