File Coverage

blib/lib/RPC/Lite/Response.pm
Criterion Covered Total %
statement 3 12 25.0
branch 0 4 0.0
condition n/a
subroutine 1 5 20.0
pod 4 4 100.0
total 8 25 32.0


line stmt bran cond sub pod time code
1             package RPC::Lite::Response;
2              
3 3     3   255 use strict;
  3         6  
  3         553  
4              
5             =pod
6              
7             =head1 NAME
8              
9             RPC::Lite::Response -- Response object for RPC::Lite.
10              
11             =head1 DESCRIPTION
12              
13             RPC::Lite::Response encapsulates a response from an RPC::Lite::Server. It is
14             the object that is serialized and returned over the transport layer.
15              
16             =head1 METHODS
17              
18             =over 4
19              
20             =cut
21              
22             =pod
23              
24             =item C
25              
26             Takes the data to place into the Result field.
27              
28             =cut
29              
30             sub new
31             {
32 0     0 1   my ( $class, $data ) = @_;
33              
34 0           my $self = bless {}, $class;
35 0           $self->Result($data);
36              
37 0           return $self;
38             }
39              
40             =pod
41              
42             =item C
43              
44             Returns the result (native object) of the request.
45              
46             =cut
47              
48 0 0   0 1   sub Result { $_[0]->{result} = $_[1] if @_ > 1; $_[0]->{result} }
  0            
49              
50             =pod
51              
52             =item C
53              
54             Returns undef on a valid response. Will only be filled in on RPC::Lite::Error
55             objects.
56              
57             =cut
58              
59 0     0 1   sub Error { return undef }
60              
61             =pod
62              
63             =item C
64              
65             The unique id of this response. The id will match the id of the request that
66             generated the response. This is used for handing asynchronous requests/responses.
67              
68             =cut
69              
70 0 0   0 1   sub Id { $_[0]->{id} = $_[1] if @_ > 1; $_[0]->{id} }
  0            
71              
72             =pod
73              
74             =back
75              
76             =head1 SEE ALSO
77              
78             RPC::Lite::Error
79              
80             =cut
81              
82             1;