首页 > 代码库 > LWP::UserAgent介绍1

LWP::UserAgent介绍1

 1 require LWP::UserAgent;
 2  
 3 my $ua = LWP::UserAgent->new;
 4 $ua->timeout(10);
 5 $ua->env_proxy;
 6  
 7 my $response = $ua->get(http://search.cpan.org/);
 8  
 9 if ($response->is_success) {
10 print $response->decoded_content;  # or whatever
11 }
12 else {
13 die $response->status_line;
14 }

 

LWP::UserAgent介绍1