| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SSH::RPC::Result; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = 1.201; |
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1205
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
89
|
|
|
6
|
2
|
|
|
2
|
|
984
|
use Class::InsideOut qw(private id register); |
|
|
2
|
|
|
|
|
7116
|
|
|
|
2
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
SSH::RPC::Result - Provides methods for the response from a SSH::RPC::Client run() method request. |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This module is never used directly by you. Instead you'll ge a reference to this object as it's created by L. |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 METHODS |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
The following methods are accessible from this class. |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
private response => my %response; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 getError () |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Returns the human readable error message (if any). |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub getError { |
|
33
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
|
34
|
2
|
|
|
|
|
11
|
return $response{id $self}{error}; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 getResponse () |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Returns the return value(s) from the RPC, whether that be a scalar value, or a hash reference or array reference. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub getResponse { |
|
46
|
5
|
|
|
5
|
1
|
67
|
my $self = shift; |
|
47
|
5
|
|
|
|
|
31
|
return $response{id $self}{response}; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 getShellVersion () |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Returns the $VERSION from the shell. This is useful if you have different versions of your shell running on different machines, and you need to do something differently to account for that. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub getShellVersion { |
|
59
|
1
|
|
|
1
|
1
|
1
|
my $self = shift; |
|
60
|
1
|
|
|
|
|
6
|
return $response{id $self}{version}; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 getStatus () |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Returns a status code for the RPC. The built in status codes are: |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
200 - Success. |
|
70
|
|
|
|
|
|
|
400 - Malform request received by shell. |
|
71
|
|
|
|
|
|
|
405 - RPC called a method that doesn't exist. |
|
72
|
|
|
|
|
|
|
406 - Error transmitting RPC. |
|
73
|
|
|
|
|
|
|
408 - Connection error. |
|
74
|
|
|
|
|
|
|
500 - An undefined error occured in the shell. |
|
75
|
|
|
|
|
|
|
510 - Error translating return document in client. |
|
76
|
|
|
|
|
|
|
511 - Error translating return document in shell. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub getStatus { |
|
81
|
4
|
|
|
4
|
1
|
69
|
my $self = shift; |
|
82
|
4
|
|
|
|
|
25
|
return $response{id $self}{status}; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 isSuccess () |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Returns true if the request was successful, or false if it wasn't. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub isSuccess { |
|
94
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
|
95
|
2
|
|
|
|
|
4
|
return ($self->getStatus == 200); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#------------------------------------------------------------------- |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 new ( result ) |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Constructor. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head3 result |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Result hash ref data structure generated by SSH::RPC::Client. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub new { |
|
111
|
4
|
|
|
4
|
1
|
722
|
my ($class, $result) = @_; |
|
112
|
4
|
|
|
|
|
11
|
my $self = register($class); |
|
113
|
4
|
|
|
|
|
58
|
$response{id $self} = $result; |
|
114
|
4
|
|
|
|
|
7
|
return $self; |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 PREREQS |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This package requires the following modules: |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHOR |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
JT Smith |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 LEGAL |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
------------------------------------------------------------------- |
|
130
|
|
|
|
|
|
|
SSH::RPC::Result is Copyright 2008-2009 Plain Black Corporation |
|
131
|
|
|
|
|
|
|
and is licensed under the same terms as Perl itself. |
|
132
|
|
|
|
|
|
|
------------------------------------------------------------------- |
|
133
|
|
|
|
|
|
|
http://www.plainblack.com info@plainblack.com |
|
134
|
|
|
|
|
|
|
------------------------------------------------------------------- |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |
|
140
|
|
|
|
|
|
|
|