Dillman has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I'm trying to download a file using the code below, it works most of the time but when the file is too large then it fails. If the file is less than 101MB it works but if it is over 180MB it seems to time out and fails.

$agent->get( $url, ':content_file' => "$destfilepath" );

I'm looking forward to your responses.

Replies are listed 'Best First'.
Re: Downloading large file fails using Mechanize get function
by Limbic~Region (Chancellor) on Nov 05, 2013 at 15:29 UTC
    Dillman,
    It could be a number of things but the first thing I would do is increase the timeout. Remember that WWW::Mechanize is a subclass of LWP::Useragent. I believe the default is 180.
    $agent->timeout(300);
    There is also a max_size but the default is undefined and I don't believe WWW::Mechanize doesn't change it.

    Cheers - L~R

      thanks for the response, I will give that a try and let you know the results.

      Thanks Limbic, after increasing the timeout my script has been working better

Re: Downloading large file fails using Mechanize get function (resume)
by Anonymous Monk on Nov 06, 2013 at 00:04 UTC