| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package cPanel::APIClient::Response::UAPI; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
14
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
59
|
|
|
4
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
59
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=encoding utf-8 |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
cPanel::APIClient::Response::UAPI |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
See L. |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
This class represents a response to a cPanel UAPI request. |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
|
23
|
|
|
|
|
|
|
|
|
24
|
2
|
|
|
2
|
|
11
|
use parent qw( cPanel::APIClient::Response ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
9
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
|
935
|
use Call::Context; |
|
|
2
|
|
|
|
|
743
|
|
|
|
2
|
|
|
|
|
609
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 $yn = I->succeeded() |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Returns a boolean that indicates whether the request succeeded. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub succeeded { |
|
39
|
3
|
|
|
3
|
1
|
3733
|
my ($self) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
3
|
100
|
|
|
|
20
|
return $self->{'status'} ? 1 : 0; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 $scalar = I->get_data() |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Returns the response’s payload. If that payload is a structure, |
|
47
|
|
|
|
|
|
|
then a reference to that structure is returned. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub get_data { |
|
52
|
5
|
|
|
5
|
1
|
2831
|
my ($self) = @_; |
|
53
|
|
|
|
|
|
|
|
|
54
|
5
|
50
|
|
|
|
22
|
die "Request failed; cannot get_data()!" if !$self->{'status'}; |
|
55
|
|
|
|
|
|
|
|
|
56
|
5
|
|
|
|
|
24
|
return $self->{'data'}; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 $str = I->get_errors_as_string() |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Returns a single string with all of the response’s errors concatenated. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub get_errors_as_string { |
|
66
|
1
|
|
|
1
|
1
|
67
|
my ($self) = @_; |
|
67
|
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
4
|
return join( $/, $self->get_errors() ); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 @errs = I->get_errors() |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Returns a list of all the response’s errors. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Must be called in list context. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub get_errors { |
|
80
|
4
|
|
|
4
|
1
|
8143
|
my ($self) = @_; |
|
81
|
|
|
|
|
|
|
|
|
82
|
4
|
|
|
|
|
14
|
return $self->_get_list('errors'); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 @warnings = I->get_warnings() |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Like C but returns warnings. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub get_warnings { |
|
92
|
3
|
|
|
3
|
1
|
7844
|
my ($self) = @_; |
|
93
|
|
|
|
|
|
|
|
|
94
|
3
|
|
|
|
|
12
|
return $self->_get_list('warnings'); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 @messages = I->get_messages() |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Like C but returns informational messages. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub get_messages { |
|
104
|
3
|
|
|
3
|
1
|
2914
|
my ($self) = @_; |
|
105
|
|
|
|
|
|
|
|
|
106
|
3
|
|
|
|
|
18
|
return $self->_get_list('messages'); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub _get_list { |
|
112
|
10
|
|
|
10
|
|
25
|
my ( $self, $name ) = @_; |
|
113
|
|
|
|
|
|
|
|
|
114
|
10
|
|
|
|
|
33
|
Call::Context::must_be_list(); |
|
115
|
|
|
|
|
|
|
|
|
116
|
10
|
50
|
|
|
|
127
|
return $self->{$name} ? @{ $self->{$name} } : (); |
|
|
10
|
|
|
|
|
45
|
|
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 LICENSE |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Copyright 2020 cPanel, L. L. C. All rights reserved. L |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the |
|
124
|
|
|
|
|
|
|
same terms as Perl itself. See L. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |