---
name: "Cupt::Download::Progress"
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::Progress"
---

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

base class for download progess meters

## NAME

Cupt::Download::Progress - base class for download progess meters

## PARAMS

### o\_download\_speed\_accuracy

specifies the number of milliseconds that will be used for speed counting. The bigger value means more smooth speed changes. Defaults to 4000.

## METHODS

### new

creates new Cupt::Download::Progress object; should be called by subclass creating methods before all other actions

### get\_start\_time

method, returns UNIX timestamp when downloads started

### set\_long\_alias\_for\_uri

method, sets long alias for uri to show

Parameters:

*uri* - URI

*alias* - long alias string

### get\_long\_alias\_for\_uri

method, gets long alias for uri

Parameters:

*uri* - URI

Returns:

*alias* - long alias string, undef if not set

### set\_short\_alias\_for\_uri

method, sets short alias for uri to show

Parameters:

*uri* - URI

*alias* - short alias

### get\_short\_alias\_for\_uri

method, gets short alias for uri

Parameters:

*uri* - URI

Returns:

*alias* - short alias string, undef if not set

### set\_total\_estimated\_size

method, set estimated total size of downloads

Parameters:

*total\_size* - total estimated size in bytes

### progress

this method is called everytime something changed within downloading process

Parameters:

*uri* - URI of the download

Next parameters are the same as specified for the callback function for the 'perform' method of the Cupt::Download::Method class, consult its documentation.

Exceptions:

- •

  'start' - message turns download start

  *size* - size in bytes of the download, can be skipped if it's unknown before the download

- •

  'done' - message turns download finish

  *result* - 0 if success, error string in case of error

- •

  'ping' - update progress view

### hook

method which should be re-implemented by subclasses to do some useful things when progress message appeared

Parameters:

- •

  'start', `$uri` - `$uri` just started downloading

- •

  'done', `$uri`, `$result` - `$uri` just finished downloading, result is `$result`

- •

  'ping', `$update_required` - the signal to renew user-visible download progress, if `$update_required` is set to false, the subclass may choose whether it wants to update the progress or not

### get\_overall\_download\_percent

method, returns float percent value of what part of all downloads are done

### get\_overall\_downloaded\_size

method, returns the number of bytes that were fetched

### get\_overall\_estimated\_time

method, returns estimated time (in seconds) to complete the downloads

### download\_entries

mutator, returns download entry as hash { `$uri` =\> *record* }

where *record* is hash { 'number' =\> *number*, 'size' =\> *size*, 'downloaded' =\> *downloaded*' }

*number* - number of the download (starting with 1)

*size* - estimated size of the download (can be undef)

*downloaded* - already downloaded bytes count

Subclasses are free to add own fields to returned hash entry, newly added pairs key-\>value will be preserved.

### get\_download\_speed

method, returns current download speed in bytes/seconds

### finish

this method is called when all downloads are done
