# ... $response = $ua->request($request); if ($response->is_success) { print $response->decoded_content; } else { print STDERR $response->status_line, "\n"; }
"HTTP::Response" is a subclass of "HTTP::Message" and therefore inherits its methods. The following additional methods are available:
Note that the method $r->redirects is provided as a more convenient way to access the response chain.
The base URI is obtained from one the following sources (in priority order):
For backwards compatibility with older HTTP implementations we will also look for the ``Base:'' header.
If none of these sources provide an absolute URI, undef is returned.
Note: previous versions of HTTP::Response would also consider a ``Content-Location:'' header, as RFC 2616 <https://www.rfc-editor.org/rfc/rfc2616> said it should be. But this was never widely implemented by browsers, and now RFC 7231 <https://www.rfc-editor.org/rfc/rfc7231> says it should no longer be considered.
When the LWP protocol modules produce the HTTP::Response object, then any base URI embedded in the document (step 1) will already have initialized the ``Content-Base:'' header. (See ``parse_head'' in LWP::UserAgent). This means that this method only performs the last 2 steps (the content is not always available either).
The filename is obtained from one the following sources (in priority order):
If a filename cannot be derived from any of these sources, undef is returned.
In scalar context return the number of redirect responses leading up to this one.
If the response does not contain an ``Expires'' or a ``Cache-Control'' header, then this function will apply some simple heuristic based on the ``Last-Modified'' header to determine a suitable lifetime. The following options might be passed to control the heuristics:
Options might be passed to control expiry heuristics, see the description of freshness_lifetime().
Options might be passed to control expiry heuristics, see the description of freshness_lifetime().
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.