---
name: "Cupt::Download::Manager"
section: "3pm"
platform: "linux"
package: "libcupt-perl"
version: "1.5.14.1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/Cupt::Download::Manager"
---

# Cupt::Download::Manager(3pm)

file download manager for Cupt

## 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:

- uri-entries

  array of *URI entry*s, 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' }
  );
```
