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

This code will find the size of a remote file:
($ua = LWP::UserAgent->new)->timeout(20); $ua->request(HTTP::Request->new('HEAD', $url)) $size = (head $url)[1];
If I make a "simple_request" instead of a "request" can I still get the file size? Or can you only get a file size with "request"? Thanks, Ryan

Replies are listed 'Best First'.
Re: LWP: request vs. simple_request
by merlyn (Sage) on Mar 08, 2001 at 02:31 UTC
    The difference between simple_request and request is documented. {grin}

    However, in brief, simple_request makes a request, and you get the response. That's it. It's a complete response. Nothing funny about it.

    But if the response is a 3xx style response, asking for more information (for authentication), or redirecting to a different location, then request transparently handles that for you if it can.

    So, for most people, request is the right choice, but for link checking and such, simple_request is right.

    -- Randal L. Schwartz, Perl hacker