Cupt::Download::Progress(3) 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