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 }
时间: 2024-10-09 23:32:19