The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


File::Download - Fetch large files from the web


This Perl module is largely derived from the lwp-download program that is installed by LWP or the libwww-perl networking package. This module abstracts the functionality found in that perl script into a module to provide a simpler more developer-friendly interface for downloading large files.




This starts the download process by downloading the file located at the specified URL. Return true if download was successful and false otherwise.


This returns a human readable status message about the download. It can be used to determine if the download successed or not.


Get or set the current user agent that will be used in conjunctions with downloads.


Each of the following options are also accessors on the main File::Download object.


Optional. The name of the file you wish to save the download to.

If you do NOT specific an outfile, then the system will attempt to determine the destination file name based upon the requested URL.

If you specify a DIRECTORY as an outfile, then the downloaded file will be written to that directory with the file name being derived from the URL requested.

If you specify a FILE as an outfile, then the downloaded file will be saved with that name. You may use both a relative or absolute path to the file you wish to save. If a file by that name already exists you may need to specify the overwrite option (see below).


Optional. Boolean value which controls whether or not a previously downloaded file with the same file name will be overwritten. Default false.


Optional. Allowable values include "a" for ASCII and "b" for binary transfer modes. Default is "b".


Not implemented yet.


Not implemented yet.


Fetch the newest and greatest perl version:

   my $dwn = File::Download->new({
     file => $argfile,
     overwrite => 1,
     mode => ($opt{a} ? 'a' : 'b'),
   print "Downloading $url\n";
   print $dwn->download($url);
   print $dwn->status();


Gisle Aas <> - original lwp-download script Byrne Reese <> - perl module wrapper

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 250:

You forgot a '=back' before '=head2'

Around line 295:

You forgot a '=back' before '=head1'