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++; } }

In reply to WWW::Mechanize Error "GETing" stop the program, by RedGrinGo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.