Cupt::Download::Manager.3pm

Langue: en

Autres versions - même langue

Version: 2009-06-21 (debian - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Cupt::Download::Manager - file download manager for Cupt

METHODS

new

creates new Cupt::Download::Manager and returns reference to it

Parameters:

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:

uris - array of mirror URIs to download, mandatory

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(
     { 'uris' => [ 'http://www.en.debian.org' ], 'filename' => '/tmp/en.html' },
     { 'uris' => [ 'http://www.ru.debian.org' ], 'filename' => '/tmp/ru.html', 'post-action' => \&checker },
     { 'uris' => [ 'http://www.ua.debian.org' ], 'filename' => '/tmp/ua.html', 'size' => 10254 }
     { 'uris' => [
         'http://ftp.de.debian.org/debian/pool/main/n/nlkt/nlkt_0.3.2.1-2_amd64.deb',
         'http://ftp.es.debian.org/debian/pool/main/n/nlkt/nlkt_0.3.2.1-2_amd64.deb'
       ], 'filename' => '/var/cache/apt/archives/nlkt_0.3.2.1-2_amd64.deb' }
   );
 
 

set_short_alias_for_uri

method, forwards params to underlying download progress

set_long_alias_for_uri

method, forwards params to underlying download progress