NAME
File::Download - Fetch large files from the web
DESCRIPTION
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.
USAGE
METHODS
- download($url)
-
This starts the download process by downloading the file located at the specified URL. Return true if download was successful and false otherwise.
- status()
-
This returns a human readable status message about the download. It can be used to determine if the download successed or not.
- user_agent()
-
Get or set the current user agent that will be used in conjunctions with downloads.
OPTIONS
Each of the following options are also accessors on the main File::Download object.
- outfile
-
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). - overwrite
-
Optional. Boolean value which controls whether or not a previously downloaded file with the same file name will be overwritten. Default false.
- mode
-
Optional. Allowable values include "a" for ASCII and "b" for binary transfer modes. Default is "b".
- username
-
Not implemented yet.
- password
-
Not implemented yet.
EXAMPLE
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();
AUTHORS and CREDITS
Gisle Aas <gisle@aas.no> - original lwp-download script Byrne Reese <byrne@majordojo.com> - 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'