Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: HTTP Headers Using WWW::Mechanize

by Limbic~Region (Chancellor)
on Jan 31, 2005 at 15:08 UTC ( [id://426718]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: HTTP Headers Using WWW::Mechanize
in thread HTTP Headers Using WWW::Mechanize

merlyn,
What's wrong with: $mech->response->headers->as_string?

Nothing, except it solves a problem other than the one I was going after (see Description).

First, the docs for WWW::Mechanize leave a little to be desired as far as getting at the headers in the first place. You have to know that the HTTP::Response object returned by the response() method has what you are looking for.

Second, the intention by accessing them by key was just to get the value you wanted as per the Description. In this particular case, water was after the p3p key. Of course you could parse the results of the as_string method, but why?

Cheers - L~R

Replies are listed 'Best First'.
Re^3: HTTP Headers Using WWW::Mechanize
by petdance (Parson) on Jan 31, 2005 at 16:36 UTC
    Patches welcome. If something's unclear, please send me updates to the doc that expand on it. It's hard for me, as the author, to know what people need to know, or if it's not as clear as should be.

    xoxo,
    Andy

      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.

      Cheers - L~R

      So, nobody has done the patch to the documentation still.
      I've had struggle with the same thing and didn't know, how to get the headers, until i got to this post, because the documentation doesn't mention anything about it.

        You're replying to a 17 year old post, I don't see your pull request or issue to request this.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://426718]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.