This is my simple script:

======================
require LWP::UserAgent;
 
 my $ua = LWP::UserAgent->new;
 $ua->timeout(10);
 $ua->env_proxy;
 
 my $response = $ua->get('http://search.cpan.org/');
 
 if ($response->is_success) {
     print $response->content;  # or whatever
 }
 else {
     die $response->status_line;
 }
===========================

If I type a wrong url instead of www.cpan.org, the script doesn't
return a "status_line"... This is the program output:

HTTP::Response=HASH(0x845d084)->status_line

Where am I wrong?

Reply via email to