Looking through
LWP::Simple,
LWP and
lwpcook, I couldn't find documentation on accessor methods but found that some methods were available (through experimentation :-) ). I've documented some of them in the code below.
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;
my $req = head("http://perlmonks.com"); # request
if ($req) {
print "protocol:\n\t",
$req->protocol, "\n";
print "headers->etag:\n\t",
$req->headers->{etag}, "\n";
# a leading underscore is considered 'private'
# and probably should not be accessed
print "_rc:\n\t",
$req->{_rc}, "\n";
print "request->uri:\n\t",
$req->request->uri, "\n";
print "request->headers->{'user-agent'}:\n\t",
$req->request->headers->{'user-agent'}, "\n";
}
Output was:
protocol:
HTTP/1.1
headers->etag:
"e047-525cb6d2fef00"
_rc:
200
request->uri:
http://perlmonks.com
request->headers->{'user-agent'}:
LWP::Simple/6.00 libwww-perl/6.02
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.