METHODS
new
creates new Cupt::Download::Manager and returns reference to itParameters:
config - reference to Cupt::Config
progress - reference to object of subclass of Cupt::Download::Progress
download
method, adds group of download queries to queue. Blocks execution of program until all downloads are done.This method is re-entrant.
Parameters:
Sequence of hash entries with the following fields:
- uri-entries
-
array of URI entrys, mandatory
URI entry - hash entry with keys:
uri - mirror URIs to download, mandatory
short-alias - short alias for this URI, optional
long-alias - long alias for this URI, optional
- filename
- target filename, mandatory
- post-action
- reference to subroutine that will be called in case of successful download, optional
- size
- fixed size for target, will be used in sanity checks, optional
Returns:
result - '0' on success, otherwise the string that contains the fail reason,
Example:
my $download_manager = new Cupt::Download::Manager; $download_manager->download( { 'uri-entries' => [ { 'uri' => 'http://www.en.debian.org' } ], 'filename' => '/tmp/en.html' }, { 'uri-entries' => [ { 'uri' => 'http://www.ru.debian.org' } ], 'filename' => '/tmp/ru.html', 'post-action' => \&checker }, { 'uri-entries' => [ { 'uri' => 'http://www.ua.debian.org' } ], 'filename' => '/tmp/ua.html', 'size' => 10254 } { 'uri-entries' => [ { 'uri' => 'http://ftp.de.debian.org/debian/pool/main/n/nlkt/nlkt_0.3.2.1-2_amd64.deb', 'long-alias' => 'ftp.de.debian.org/debian sid/main nlkt 0.3.2.1-2', 'short-alias' => 'nlkt', }, { 'uri' => 'http://ftp.ua.debian.org/debian/pool/main/n/nlkt/nlkt_0.3.2.1-2_amd64.deb', 'long-alias' => 'ftp.ua.debian.org/debian sid/main nlkt 0.3.2.1-2', 'short-alias' => 'nlkt', }, ], 'filename' => '/var/cache/apt/archives/nlkt_0.3.2.1-2_amd64.deb' } );