This file is indexed.

/usr/share/perl5/Net/Amazon/Response.pm is in libnet-amazon-perl 0.62-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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
######################################################################
package Net::Amazon::Response;
######################################################################
use warnings;
use strict;

use base qw(Net::Amazon);

use Text::Wrap qw($columns wrap);
use XML::Simple;
use Log::Log4perl qw(:easy get_logger);

our @FORCE_ARRAY_FIELDS = qw(Author Artist Creator Director Disc
Review EditorialReview SimilarProduct Track);

__PACKAGE__->make_accessor($_) for qw(
  status messages items xmlref total_results);

##################################################
sub new {
##################################################
    my($class, %options) = @_;

    my $self = {
        status        => "",
        messages      => [],
        items         => [],
        xmlref        => {},
        total_results => undef,
    };

    bless $self, $class;
}

sub message {
  my($self) = @_;

  return join(";",@{$self->{messages}});
}

###########################################
sub is_success {
###########################################
    my($self) = @_;

    return $self->{status} ? 1 : "";
}

###########################################
sub is_error {
###########################################
    my($self) = @_;

    return !$self->is_success();
}

###########################################
sub push_item {
###########################################
    my($self, $item) = @_;

    push @{$self->{items}}, $item;
}

###########################################
sub as_string {
###########################################
    my($self) = @_;

    return Data::Dumper::Dumper($self);
}

###########################################
sub list_as_string {
###########################################
    my($self, @properties) = @_;

    my $full = "";

    # Column with
    $columns   = 60;
    my $bullet = 1;

    foreach my $property (@properties) {
        $full .= "\n" if $full;
        my $bullet_string = sprintf("[%d]%s", 
                                    $bullet, (" " x (3-length($bullet))));
        $full .= wrap("", "     ", $bullet_string . $property->as_string());
        $bullet++;
    }

    return $full;
}

##################################################
sub properties {
##################################################
    my($self) = @_;

    my @properties = ();

    if($self->is_success && ref($self->{xmlref}->{Items}) eq 'ARRAY') {
        foreach my $xmlref (@{$self->{xmlref}->{Items}}) {
            my $property = Net::Amazon::Property::factory(xmlref => $xmlref);
            push @properties, $property;
        }
    }

    if(wantarray) {
        return (@properties);
    }

    if(@properties) {
        # Scalar context and we've got results. Return the first one.
        return $properties[0];
    }

    # Scalar context and we don't have anything.
    return undef;
}

##################################################
sub xml_parse {
##################################################
    my($self, $xml) = @_;

    my $xs = XML::Simple->new();
    return $xs->XMLin($xml, ForceArray => [ @FORCE_ARRAY_FIELDS ]);
}

1;

__END__

=head1 NAME

Net::Amazon::Response - Baseclass for responses from Amazon's web service

=head1 SYNOPSIS

    $resp = $ua->request($request);

    if($resp->is_success()) { 
        print $resp->as_string();
    }

    if($resp->is_error()) {
        print $resp->message();
    }

    if($resp->is_success()) { 
        for my $property ($resp->properties) {
            print $property->as_string(), "\n";
        }
    }

=head1 DESCRIPTION

C<Net::Amazon::Response> is the baseclass for responses coming back 
from the useragent's C<request> method. Responses are typically
not of type C<Net::Amazon::Response> but one of its subclasses
C<Net::Amazon::Response::*>. However, for basic error handling and
dumping content, C<Net::Amazon::Response>'s methods are typically used,
because we typically don't know what type of object we're 
actually dealing with.

=head2 METHODS

=over 4

=item is_success()

Returns true if the request was successful. This doesn't mean any objects
have been found, it just indicates a successful roundtrip.

=item is_error()

Returns true if an error occurred. Use C<message()> to determine what 
kind of error.

=item properties()

Returns the list of C<Net::Amazon::Property> objects which were found
by the query.

=item as_string()

Dumps the content of the response.

=item message()

Returns the error message as a string in case an error occurred. In case
several errors occurred, they're stringed together. Look up C<messages()>
if you need them separated.

=item messages()

Returns all error messages for a response as a reference to an array
of string messages.

=back

=head1 AUTHOR

Mike Schilli, E<lt>m@perlmeister.comE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright 2003 by Mike Schilli E<lt>m@perlmeister.comE<gt>

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. 

=cut