By the way, I'll be giving a tutorial about LWP at the The Perl Conference
in July in San Diego; the kind of stuff you ask about is exactly what the
talk is about: it's an introduction to LWP.

I'm also working on a book for O'Reilly about things like this, too.  It
should be out sometime before the Robot Holocaust.


At 09:19 PM 2001-05-22 -0400, David Kuo wrote:
>[...]But how about the "POST" method? How do I send out the
>arguments to the web server? If the syntax "$request = new
>HTTP::Request('POST' => $url, [name1 => value1, name2
> => value2, ...,]);" correct? [...]

I call using HTTP::Request->new the bad old way.  (Well, it's not exactly
bad, it's just not especially convenient for most purposes.)

The /good/ old way is:

use LWP;
my $browser = LWP::UserAgent->new();
use HTTP::Request::Common;  # exports POST(...) et al

my $request = POST($url, [name1 => value1, name2 => value2, ...,]);
my $response = $browser->request($request);


And the good /new/ way is:

use LWP 5.5394;   # a devel version, by the way
my $browser = LWP::UserAgent->new();

my $response = $browser->post($url,
  [name1 => value1, name2 => value2, ...,],
);


--
Sean M. Burke  [EMAIL PROTECTED]  http://www.spinn.net/~sburke/

Reply via email to