By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,933 Members | 1,716 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,933 IT Pros & Developers. It's quick & easy.

501 Protocol scheme '' is not supported error when using LWP

P: 5
hi

I'm trying to use the example here:
http://search.cpan.org/~gaas/libwww-....pm#An_Example

here is the code:
Expand|Select|Wrap|Line Numbers
  1. use LWP::UserAgent;
  2. use LWP::Debug qw(+); 
  3.  
  4.     # Create a user agent object
  5.     my $ua = LWP::UserAgent->new;
  6.     $ua->agent("MyApp/0.1 ");
  7.  
  8.     # Create a request
  9.     my $req = HTTP::Request->new(POST => 'http://search.cpan.org/search');
  10.     $req->content_type('application/x-www-form-urlencoded');
  11.     $req->content('query=libwww-perl&mode=dist');
  12.  
  13.     # Pass request to the user agent and get a response back
  14.     my $res = $ua->request($req);
  15.  
  16.     # Check the outcome of the response
  17.     if ($res->is_success) {
  18.         print $res->content;
  19.     } else {
  20.       print $res->status_line, "\n";
  21.     }
  22.  
and here is the response:
Expand|Select|Wrap|Line Numbers
  1. LWP::UserAgent::new: ()
  2. LWP::UserAgent::request: ()
  3. LWP::UserAgent::send_request: POST http://search.cpan.org/search
  4. LWP::UserAgent::request: Simple response: Not Implemented
  5. 501 Protocol scheme '' is not supported
  6.  
what am I doing wrong? what is the meaning of the error response?
Jun 9 '10 #1
Share this Question
Share on Google+
1 Reply


Expert Mod 100+
P: 589
Try using a GET request instead of the POST request.
Jun 9 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.