line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package cPanel::APIClient::Response::UAPI; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
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
|
|
|
|
|
10
|
|
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
|
923
|
use Call::Context; |
|
2
|
|
|
|
|
746
|
|
|
2
|
|
|
|
|
605
|
|
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
|
3682
|
my ($self) = @_; |
40
|
|
|
|
|
|
|
|
41
|
3
|
100
|
|
|
|
17
|
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
|
2443
|
my ($self) = @_; |
53
|
|
|
|
|
|
|
|
54
|
5
|
50
|
|
|
|
19
|
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
|
66
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
5
|
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
|
9632
|
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
|
7517
|
my ($self) = @_; |
93
|
|
|
|
|
|
|
|
94
|
3
|
|
|
|
|
10
|
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
|
2531
|
my ($self) = @_; |
105
|
|
|
|
|
|
|
|
106
|
3
|
|
|
|
|
19
|
return $self->_get_list('messages'); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub _get_list { |
112
|
10
|
|
|
10
|
|
23
|
my ( $self, $name ) = @_; |
113
|
|
|
|
|
|
|
|
114
|
10
|
|
|
|
|
30
|
Call::Context::must_be_list(); |
115
|
|
|
|
|
|
|
|
116
|
10
|
50
|
|
|
|
115
|
return $self->{$name} ? @{ $self->{$name} } : (); |
|
10
|
|
|
|
|
41
|
|
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; |