The first example in LWP.pm shows a POST request whose
content and headers are constructed manually.  BackPAN
tells me this examplee preceded the introduction of
HTTP::Request::Common, and I see on clpmisc that some
people think this manual method is the best way to do
a POST because of this example.  Therefore, this patch:

--- LWP.pm.orig 2003-12-30 08:24:29.000000000 -0800
+++ LWP.pm      2003-12-30 08:28:04.000000000 -0800
@@ -302,9 +302,9 @@
   $ua->agent("MyApp/0.1 ");
 
   # Create a request
-  my $req = HTTP::Request->new(POST => 'http://search.cpan.org/search');
-  $req->content_type('application/x-www-form-urlencoded');
-  $req->content('query=libwww-perl&mode=dist');
+  use HTTP::Request::Common;
+  my $req = POST 'http://search.cpan.org/search',
+                 [ query => 'libwww-perl', mode => 'dist' ];
 
   # Pass request to the user agent and get a response back
   my $res = $ua->request($req);

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http//www.perlmedic.com/

Reply via email to