1Net::Amazon::Response(3U)ser Contributed Perl DocumentatiNoent::Amazon::Response(3)
2
3
4
6 Net::Amazon::Response - Baseclass for responses from Amazon's web
7 service
8
10 $resp = $ua->request($request);
11
12 if($resp->is_success()) {
13 print $resp->as_string();
14 }
15
16 if($resp->is_error()) {
17 print $resp->message();
18 }
19
20 if($resp->is_success()) {
21 for my $property ($resp->properties) {
22 print $property->as_string(), "\n";
23 }
24 }
25
27 "Net::Amazon::Response" is the baseclass for responses coming back from
28 the useragent's "request" method. Responses are typically not of type
29 "Net::Amazon::Response" but one of its subclasses
30 "Net::Amazon::Response::*". However, for basic error handling and
31 dumping content, "Net::Amazon::Response"'s methods are typically used,
32 because we typically don't know what type of object we're actually
33 dealing with.
34
35 METHODS
36 is_success()
37 Returns true if the request was successful. This doesn't mean any
38 objects have been found, it just indicates a successful roundtrip.
39
40 is_error()
41 Returns true if an error occurred. Use "message()" to determine
42 what kind of error.
43
44 properties()
45 Returns the list of "Net::Amazon::Property" objects which were
46 found by the query.
47
48 as_string()
49 Dumps the content of the response.
50
51 message()
52 Returns the error message as a string in case an error occurred. In
53 case several errors occurred, they're stringed together. Look up
54 "messages()" if you need them separated.
55
56 messages()
57 Returns all error messages for a response as a reference to an
58 array of string messages.
59
61 Mike Schilli, <m@perlmeister.com>
62
64 Copyright 2003 by Mike Schilli <m@perlmeister.com>
65
66 This library is free software; you can redistribute it and/or modify it
67 under the same terms as Perl itself.
68
69
70
71perl v5.28.0 2009-09-15 Net::Amazon::Response(3)