if (defined $lsize) {
&DEBUG("FTP: locsize => '$lsize'.");
if ($size != $lsize) {
- &WARN("FTP: downloaded file seems truncated. FIXME.");
+ &FIXME("FTP: downloaded file seems truncated.");
}
}
my $delta_time = &timedelta($start_time);
if ($delta_time > 0 and $verbose_ftp) {
&status(sprintf("FTP: %.02f sec to complete.", $delta_time));
- my ($rateunit,$rate) = ("B", $size / $delta_time);
+ my ($rateunit,$rate) = ('B', $size / $delta_time);
if ($rate > 1024) {
$rate /= 1024;
- $rateunit = "kB";
+ $rateunit = 'kB';
}
&status(sprintf("FTP: %.01f ${rateunit}/sec.", $rate));
}
### LWP.
# Usage: &getURL($url, [$post]);
-# todo: rename this to getHTTP
+# TODO: rename this to getHTTP
sub getURL {
my ($url,$post) = @_;
my ($ua,$res,$req);
return unless &loadPerlModule("LWP::UserAgent");
$ua = new LWP::UserAgent;
- $ua->proxy('http', $param{'httpProxy'}) if &IsParam("httpProxy");
+ $ua->proxy('http', $param{'httpProxy'}) if &IsParam('httpProxy');
if (defined $post) {
$req = new HTTP::Request('POST',$url);
my ($ua,$res,$req);
my $time = time();
- return unless &loadPerlModule("LWP::UserAgent");
+ unless (&loadPerlModule('LWP::UserAgent')) {
+ &::DEBUG('getURLAsFile: LWP::UserAgent not installed');
+ return;
+ }
$ua = new LWP::UserAgent;
- $ua->proxy('http', $param{'httpProxy'}) if &IsParam("httpProxy");
+ $ua->proxy('http', $param{'httpProxy'}) if &IsParam('httpProxy');
$req = HTTP::Request->new('GET', $url);
&status("getURLAsFile: getting '$url' as '$file'");
$res = $ua->request($req, $file);
}
1;
+
+# vim:ts=4:sw=4:expandtab:tw=80