1CPANPLUS::Internals::FeUtscehr(3C)ontributed Perl DocumeCnPtAaNtPiLoUnS::Internals::Fetch(3)
2
3
4

NAME

6       CPANPLUS::Internals::Fetch - internals for fetching files
7

SYNOPSIS

9           my $output = $cb->_fetch(
10                               module      => $modobj,
11                               fetchdir    => '/path/to/save/to',
12                               verbose     => BOOL,
13                               force       => BOOL,
14                           );
15
16           $cb->_add_fail_host( host => 'foo.com' );
17           $cb->_host_ok(       host => 'foo.com' );
18

DESCRIPTION

20       CPANPLUS::Internals::Fetch fetches files from either ftp, http, file or
21       rsync mirrors.
22
23       This is the rough flow:
24
25           $cb->_fetch
26               Delegate to File::Fetch;
27

METHODS

$path = _fetch( module => $modobj, [fetchdir => '/path/to/save/to', fetch_from

30       => 'scheme://path/to/fetch/from', verbose => BOOL, force => BOOL,
31       prefer_bin => BOOL, ttl => $seconds] )
32       "_fetch" will fetch files based on the information in a module object.
33       You always need a module object. If you want a fake module object for a
34       one-off fetch, look at "CPANPLUS::Module::Fake".
35
36       "fetchdir" is the place to save the file to. Usually this information
37       comes from your configuration, but you can override it expressly if
38       needed.
39
40       "fetch_from" lets you specify an URI to get this file from. If you do
41       not specify one, your list of configured hosts will be probed to
42       download the file from.
43
44       "force" forces a new download, even if the file already exists.
45
46       "verbose" simply indicates whether or not to print extra messages.
47
48       "prefer_bin" indicates whether you prefer the use of commandline
49       programs over perl modules. Defaults to your corresponding config
50       setting.
51
52       "ttl" (in seconds) indicates how long a cached copy is valid for. If
53       the fetch time of the local copy is within the ttl, the cached copy is
54       returned. Otherwise, the file is refetched.
55
56       "_fetch" figures out, based on the host list, what scheme to use and
57       from there, delegates to "File::Fetch" do the actual fetching.
58
59       Returns the path of the output file on success, false on failure.
60
61       Note that you can set a "blacklist" on certain methods in the config.
62       Simply add the identifying name of the method (ie, "lwp") to:
63           $conf->_set_fetch( blacklist => ['lwp'] );
64
65       And the "LWP" function will be skipped by "File::Fetch".
66
67   _add_fail_host( host => $host_hashref )
68       Mark a particular host as bad. This makes "CPANPLUS::Internals::Fetch"
69       skip it in fetches until this cache is flushed.
70
71   _host_ok( host => $host_hashref )
72       Query the cache to see if this host is ok, or if it has been flagged as
73       bad.
74
75       Returns true if the host is ok, false otherwise.
76
77
78
79perl v5.36.0                      2022-07-22     CPANPLUS::Internals::Fetch(3)
Impressum