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

Hi there, I'm stuck with a problem stemming from the content that LWP::UserAgent inserts into documents it downloads. In essence, I have a module which uses LWP::UserAgent to download .xml files from various machines, inserting all of the HTTP headers before the actual XML. I'm using the remove_header() method from HTTP::Message to strip all of the other headers, but cannot get rid of this one:

HTTP/1.0 200 Request fulfilled, document follows

This in itself wouldn't be an issue, but XML::LIbXML is crying all over itself when it encounters this line.

It could, of course, be the way that I'm writing the file to disk, which is like this:

if ( $res->is_success ) { open(FH, '>', "/usr/local/share/scripts/rrdtools/xml/$applianc +e.xml"); print FH $res->as_string; close(FH); } else { print "Failed downloading from ", $appliance ,": ", $res->sta +tus_line, "\n"; }

Replies are listed 'Best First'.
Re: Remove LWP::UserAgent
by Anonymous Monk on Nov 14, 2008 at 09:45 UTC

    Try $res->content

      Or ->decoded_content();