petdance,
It isn't specifically that something is unclear. It is that WWW::Mechanize is built on a lot of prior art.

There isn't a succintly way to say that WWW::Mechanize is a subclass of LWP::UserAgent which uses HTTP::Response which is a subclass of HTTP::Message which uses HTTP::Headers so while there isn't a direct method of listing the header keys or there values, you can still get to them.

Even if that could be said concisely, it would only address the headers issue. The underlying issue is that to get the absolute most out of a module like WWW::Mechanize, the user needs to spend some time understanding the prior art and how it is being used. As such, my patch is just an addition to the FAQ. While I have emailed it to you, I am including a copy here as well.

--- FAQ.pod 2004-06-25 23:10:45.000000000 -0400 +++ FAQ.new 2005-02-01 09:18:30.865078400 -0500 @@ -49,6 +49,19 @@ my @frame_links = $mech->find_link( tag => "frame" ); +=head2 How do I get a list of HTTP headers and their values? + +All L<HTTP::Headers> methods work on a L<HTTP::Response> object which + is +returned by the I<get()>, I<reload()>, I<response()/res()>, I<click() +>, +I<submit_form()>, and I<request()> methods. + + my $mech = WWW::Mechanize->new( autocheck => 1 ); + $mech->get( 'http://my.site.com' ); + my $res = $mech->response(); + for my $key ( $response->header_field_names() ) { + print $key, " : ", $response->header( $key ), "\n"; + } + =head1 Why doesn't this work? =head2 Why don't https:// URLs work?

Cheers - L~R


In reply to Re^4: HTTP Headers Using WWW::Mechanize by Limbic~Region
in thread HTTP Headers Using WWW::Mechanize by Limbic~Region

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.