/usr/share/perl5/Net/Akamai/ResponseData.pm is in libnet-akamai-perl 0.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | package Net::Akamai::ResponseData;
use Moose;
=head1 NAME
Net::Akamai::ResponseData - Object to hold response data
=head1 DESCRIPTION
Data container for an akamai purge response
=cut
=head1 Attributes
=head2 uri_index
Identifies the index of the first failed URL in the array.
A value of -1 indicates no bad URLs, or error before parsing them.
=cut
has 'uri_index' => (
is => 'ro',
isa => 'Int',
required => 1,
default => '-1',
);
=head2 result_code
Indicates sucess or failure of request
=cut
has 'result_code' => (
is => 'ro',
isa => 'Int',
required => 1,
default => '0',
);
=head2 est_time
Estimated time for request to be processed in seconds
=cut
has 'est_time' => (
is => 'ro',
isa => 'Int',
required => 1,
default => '0',
);
=head2 session_id
Unique id for request
=cut
has 'session_id' => (
is => 'ro',
isa => 'Str',
required => 1,
default => '',
);
=head2 result_msg
Explains result code
=cut
has 'result_msg' => (
is => 'ro',
isa => 'Str',
required => 1,
default => '',
);
=head1 Methods
=head2 successful
Returns true if the result code is of the 1xx (successful) variety.
=cut
sub successful {
my $self = shift;
return 1 if $self->result_code() =~ /1\d\d/;
return;
}
=head2 warning
Returns true if the result code is of the 2xx (warning) variety.
The Akamai documentation states that "The remove request has been
accepted" even when a warning response is sent.
=cut
sub warning {
my $self = shift;
return 1 if $self->result_code() =~ /2\d\d/;
return;
}
=head2 accepted
Returns true if the result code is of the 1xx (successful) or 2xx
(warning) varieties. This indicates that the remove request was
accepted by Akamai. You should still check to see if there was a
warning, and if their was report it.
=cut
sub accepted {
my $self = shift;
return 1 if $self->successful();
return 1 if $self->warning();
return;
}
=head2 message
if (!$res_data->accepted()) {
# These do the same thing:
die "$res_data";
die $res_data->message();
}
Returns a nicely formatted string containing the result_code and result_msg.
=cut
use overload '""' => \&message, fallback => 1;
sub message {
my $self = shift;
my $code = $self->result_code();
my $message = $self->successful() ? 'SUCCESSFUL'
: $self->warning() ? 'WARNING'
: 'REJECTED';
return $self->result_code() . " $message: " . $self->result_msg();
}
=head1 AUTHOR
John Goulah <jgoulah@cpan.org>
=head1 LICENSE
This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
1;
|