in reply to man HTTP::Request::Common

It sets the body of the request. That has nothing to do with the "destination". Nominally, only POST and PUT requests may (and should) have a body so in practice, you don't use Content on GET requests.

You really have a HTTP- and not Perl question, so you may want to read up on the protocol to understand what's going on there. Otherwise, tell us what you want to do and we'll provide the pointers you need to reach a solution.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: man HTTP::Request::Common
by Anonymous Monk on Jul 03, 2002 at 21:38 UTC
    Don't know if you saw this, so I will send it again (I replied to the top level instead of to your message).

    Right now, I just want the easiest way to download specific URLs to files.

    It seems that a lot of (related) packages exist:
    HTTP::Request
    HTTP::Request::Common
    HTTP::Response
    LWP::Simple
    LWP::UserAgent
    and even Net::HTTP

    I know that "more than one way exists to do it, but some explanation of the differences could help me choose the best way (for me). Thanks again.

      Actually, they are not all the same thing - they supplement each other like gearwheels. The full process is that you set up a HTTP::Request, which sent to the server via the Net::HTTP module by a LWP::UserAgent object which then constructs a HTTP::Response.

      The HTTP::Request::Common module is simply a convenience tool that provides shortcuts to common tasks in setting up HTTP::Requests.

      Likewise, the LWP::Simple module is a library that provides shortcuts to common web-related tasks. As long as you don't need finegrained control over the process, it takes care of the entire mumbojumbo of setting up a UserAgent, a Request to pass to it, and pulling the data back out of the Response and reduces it to something as simple as $page = get("http://foo.com/bar.html");.

      In your case, the gestore function does exactly what you want, as a look into the module's documentation would reveal.

      In general, if you have a task and don't know which module to look at first, the best idea is probably to look at whatever is called ::Simple* or ::Easy*.

      Makeshifts last the longest.