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

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

base class for all Cupt download methods

## NAME

Cupt::Download::Method - base class for all Cupt download methods

## ABSTRACT

It should be never instantiated directly. If you want to write your own download method for Cupt, you are need to implement 'perform' method specified under.

## METHODS

### new

creates new Cupt::Download::Method object

### perform

downloads specified file

Parameters:

*config* - reference to Cupt::Config

*uri* - string that determines URL to download

*filename* - target file name

*sub\_callback* - callback subroutine to report status change of download

Allowed param sets:

- •

  "connecting", "$ip\[:$port\]"

- •

  "expected-size", *expected\_size*

- •

  "downloading" - *total\_downloaded\_bytes* *fetched\_bytes*;

where:

*expected\_size* - size of file to download

*total\_downloaded\_bytes* - number of bytes done for download; in case of resumed download this number should include already downloaded size

*fetched\_bytes* - number of bytes that were really fetched since the last callback call

Returns: '' if all went smoothly, error string in case of error

## FREE SUBROUTINES

### get\_acquire\_suboption\_for\_uri

returns the value of some acquire suboption of 'acquire' group should be used for supplied URI. This subroutine honors global and per-host settings.

Parameters:

*config* - reference to Cupt::Config

*uri* - URI string

*suboption\_name* - suboption name

Example:

`"get_acquire_param_for_uri($config, $uri, 'proxy')"`
