Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
that is a section of my code.my $ua = LWP::UserAgent->new; $ua->agent("Mozilla/8.0"); $ua->cookie_jar(HTTP::Cookies->new(file => "lwpcookies.txt", autosave => 1)); push @{$ua->requests_redirectable}, 'GET'; my $req = HTTP::Request->new(GET => "$_fileLoc"); $req->referer($_fileLoc); # Pass request to the user agent and get a response back $res = $ua->request($req); print $res->status_line, "\n"; if($res->status_line =~ /404 Not Found/i) { $_bad++; } else { if($res->is_success) { print $res->is_success, "\n"; if($res->status_line =~ /404 Not Found/i) { $_bad++; } else { $_cn = $res->content; print $_cn, "\n"; } } else { $_bad1++; $_errorT = $res->status_line; print qq~error: "~ . $_errorT . '"'. \t;#' } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP Question
by zentara (Cardinal) on Dec 10, 2012 at 22:58 UTC | |
|
Re: LWP Question
by Khen1950fx (Canon) on Dec 11, 2012 at 07:46 UTC |