RedGrinGo has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
I made a simple script which should download some file to my PC, the program make a request with LWP and from the HTML I get the links to the files I need into an array. Now I use WWW::Mechanize to get the files (I know that there are some other options but I can use only this one). when there is a link that appears to be wrong the program exit with an error: "Error GETing some_url Internal Server Error at myscript.pl line 171" Now what I need is, even if there is an error I want the script to move to the next URL on the Array without exiting. Any suggestions ???
sub getFile{ my @files = @_; my $mech = WWW::Mechanize->new; my $fileIndex = 1; foreach my $file (@files){ $mech->get( $file, ':content_file' => "myFile$fileIndex.txt" ) +; $fileIndex++; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW::Mechanize Error "GETing" stop the program,
by Corion (Patriarch) on Apr 14, 2010 at 13:48 UTC | |
by RedGrinGo (Novice) on Apr 15, 2010 at 08:34 UTC | |
by Corion (Patriarch) on Apr 15, 2010 at 08:38 UTC | |
|
Re: WWW::Mechanize Error "GETing" stop the program,
by Anonymous Monk on Apr 14, 2010 at 13:43 UTC | |
by Corion (Patriarch) on Apr 14, 2010 at 14:04 UTC | |
by Anonymous Monk on Apr 14, 2010 at 14:08 UTC | |
by RedGrinGo (Novice) on Apr 14, 2010 at 13:50 UTC | |
by Anonymous Monk on Apr 14, 2010 at 13:55 UTC |