crazyinsomniac has asked for the wisdom of the Perl Monks concerning the following question:

yo, I was doing some stuff, and reading pod like always, when I came accross
$ua->parse_head($boolean)

Get/set a value indicating wether we should initialize response headers from the <head> section of HTML documents. The default is TRUE. Do not turn this off, unless you know what you are doing.
in LWP::UserAgent.

What does "Do not turn this off, unless you know what you are doing" mean?

or should I ask, why shouldn't I turn it off, what exactly is it doing?

I super searched for ->parse_head and I can't believe nothing turned up (well nothing relevant). I took a look at the source, but it's too much for me to grock at the moment, but here is some of it (from LWP::Protocol, sub collect):
if ($parse_head && $response->content_type eq 'text/html') { $parser = HTML::HeadParser->new($response->{'_headers'}); }....
From what I can gather from reading, is that it parses stuff in the head section of html documents, and sets some kind of HTTP headers accordingly. I would appreciate more detail (and of course the answer to the question above).

 
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void

perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Replies are listed 'Best First'.
Re: LWP::UserAgent and parse_head
by trantor (Chaplain) on Nov 14, 2001 at 17:35 UTC

    It is my understanding that this method enables/disables parsing the <META HTTP-EQUIV> directives present in the <HEAD> section of an HTML document.

    As explained in the W3C site, these metadata may be used by an HTTP server to set the relevant HTTP header in the response, for that specific document, e.g.:

    <META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">

    Would set the relevant Expires: header.

    I presume that LPW::UserAgent can do the same, if the server doesn't bother doing it.

    -- TMTOWTDI