Firstly, set $File::Fetch::DEBUG=1;.

Ideally, File::Fetch should have had a method to provide it with a user-created LWP object in order for the user to have full control over it. Diagonally looking at the source:

### set up the useragent object my $ua = LWP::UserAgent->new(); $ua->timeout( $TIMEOUT ) if $TIMEOUT; $ua->agent( $USER_AGENT ); $ua->from( $FROM_EMAIL );

It looks to me you are out of luck with File::Fetch if you want to fine-tune LWP. Though, LWP is not the only tool it uses to fetch files but it seems to me it creates them on the fly during each fetch() and with a minimal set of parameters decided by it.

In the past I have used URI::Fetch which optionally accepts a pre-cooked user-specified LWP object which you can tune to your heart's content:

my $ua = LWP::UserAgent->new(...); URI::Fetch->fetch($uri, 'UserAgent' => $ua) };

FInally, LWP::UserAgent can be made super verbose (dumping the headers for example) with:

use LWP::UserAgent; use LWP::ConsoleLogger::Easy qw/debug_ua/; my $ua = LWP::UserAgent->new(...); debug_ua($ua, 10);

bw, bliako


In reply to Re^7: HTTP response: 400 Bad Request by bliako
in thread HTTP response: 400 Bad Request by JoeJohnston

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.