line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5
|
use Moops; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Amazon::SES::Response - Perl class that represents a response from AWS SES |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNPOSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# see Amazon::SES |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
This class is not meant to be used directly, but through L<Amazon::SES|Amazon::SES>. First you should be familiar with L<Amazon::SES|Amazon::SES> and only then come back to this class for new information |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 METHODS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
7412
|
class Amazon::SES::Response :ro { |
|
1
|
|
|
1
|
|
26
|
|
|
1
|
|
|
1
|
|
8
|
|
|
1
|
|
|
1
|
|
1
|
|
|
1
|
|
|
1
|
|
65
|
|
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
1
|
|
27
|
|
|
1
|
|
|
1
|
|
307
|
|
|
1
|
|
|
1
|
|
1
|
|
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
1
|
|
52
|
|
|
1
|
|
|
1
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
101
|
|
|
1
|
|
|
|
|
32
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
3566
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
496
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
130
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
70
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
206
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
984
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
2402
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
41
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
73
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
141
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
225
|
use XML::Simple; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use JSON::XS; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has 'response' => (is => 'ro'); |
25
|
|
|
|
|
|
|
has 'action' => (is => 'ro'); |
26
|
|
|
|
|
|
|
has 'data' => (is => 'rw'); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
method BUILD { |
29
|
|
|
|
|
|
|
$self->data(XMLin( |
30
|
|
|
|
|
|
|
$self->raw_content, |
31
|
|
|
|
|
|
|
GroupTags => { |
32
|
|
|
|
|
|
|
Identities => 'member', |
33
|
|
|
|
|
|
|
DkimTokens => 'member' |
34
|
|
|
|
|
|
|
}, |
35
|
|
|
|
|
|
|
KeepRoot => 0, |
36
|
|
|
|
|
|
|
ForceArray => [ 'member', 'DkimAttributes' ] |
37
|
|
|
|
|
|
|
)); |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 result() |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Returns parsed contents of the response. This is usually the contents of C<*Result> element. Exception is the error response, in which case it returns the ontents of C<Error> element. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
method result() { |
47
|
|
|
|
|
|
|
if ($self->is_error) { |
48
|
|
|
|
|
|
|
return $self->data; # error response do not have *Result containers |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
return $self->data->{ $self->action . 'Result' }; |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 message_id() |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Returns a message id for successfully sent e-mails. Only valid for successful requests. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
method message_id() { |
60
|
|
|
|
|
|
|
return unless $self->result; |
61
|
|
|
|
|
|
|
return $self->result->{'MessageId'}; |
62
|
|
|
|
|
|
|
}; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 result_as_json() |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Same as C<result()>, except converts the data into JSON notation |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
method result_as_json() { |
71
|
|
|
|
|
|
|
return JSON::XS->new->allow_nonref->encode([$self->result]); |
72
|
|
|
|
|
|
|
}; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 raw_content() |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This is the raw (unparsed) by decoded HTTP content as returned from the AWS SES. Usually you do not need it. If you think you need it just knock yourself out! |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
method raw_content() { |
81
|
|
|
|
|
|
|
return $self->response->decoded_content; |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 is_success() |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 is_error() |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This is the first thing you should check after each request(). |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
method is_success() { |
93
|
|
|
|
|
|
|
return $self->response->is_success; |
94
|
|
|
|
|
|
|
}; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
method is_error() { |
97
|
|
|
|
|
|
|
return $self->response->is_error; |
98
|
|
|
|
|
|
|
}; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 http_code() |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Since all the api request/response happens using HTTP Query actions, this code returns the HTTP response code. For all successfull response it returns C<200>, errors usually return C<400>. This is here just in case |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
method http_code() { |
108
|
|
|
|
|
|
|
return $self->response->code; |
109
|
|
|
|
|
|
|
}; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 error_code() |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Returns an error code from AWS SES. Unlik C<http_code()>, this is a short error message, as documented in AWS SES API reference |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
method error_code() { |
118
|
|
|
|
|
|
|
return $self->data->{Error}->{Code}; |
119
|
|
|
|
|
|
|
}; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 error_message() |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Returns more descriptive error message from AWS SES |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
method error_message() { |
128
|
|
|
|
|
|
|
return $self->data->{Error}->{Message}; |
129
|
|
|
|
|
|
|
}; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 error_type() |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Returns the type of the error. Most of the time in my experience it returns C<Sender>. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
method error_type() { |
138
|
|
|
|
|
|
|
return $self->data->{Error}->{Type}; |
139
|
|
|
|
|
|
|
}; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 request_id() |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Returns an ID of the request. All response, including the ones resulting in error, contain a RequestId. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
method request_id() { |
149
|
|
|
|
|
|
|
return $self->data->{RequestId} // $self->data->{'ResponseMetadata'}->{RequestId}; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 dkim_attributes() |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
The same as |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
$response->result->{DkimAttributes} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Only meaning for get_dkim_attributes() api call |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
method dkim_attributes() { |
164
|
|
|
|
|
|
|
if ( my $attributes = $self->result->{DkimAttributes}->[0]->{entry} ) { |
165
|
|
|
|
|
|
|
return $self->result->{DkimAttributes}; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
return; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 SEE ALSO |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
L<Amazon::SES|Amazon::SES> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 AUTHOR |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Rusty Conover <rusty@luckydinosaur.com> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Sherzod B. Ruzmetov E<lt>sherzodr@cpan.orgE<gt> |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Copyright (C) 2014 by Lucky Dinosaur, LLC http://www.luckydinosaur.com |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Portions Copyright (C) 2013 by L<Talibro LLC|https://www.talibro.com> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
189
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.14.2 or, |
190
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=cut |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
1; |