- ### see if we have a wget binary ###
- if( HAS_FETCH and my $fetch = can_run('fetch') ) {
-
- ### no verboseness, thanks ###
- my $cmd = [ $fetch, '-q' ];
-
- ### if a timeout is set, add it ###
- push(@$cmd, '-T', $TIMEOUT) if $TIMEOUT;
-
- ### run passive if specified ###
- #push @$cmd, '-p' if $FTP_PASSIVE;
- local $ENV{'FTP_PASSIVE_MODE'} = 1 if $FTP_PASSIVE;
-
- ### set the output document, add the uri ###
- push @$cmd, '-o', $to, $self->uri;
-
- ### with IPC::Cmd > 0.41, this is fixed in teh library,
- ### and there's no need for special casing any more.
- ### DO NOT quote things for IPC::Run, it breaks stuff.
- # $IPC::Cmd::USE_IPC_RUN
- # ? ($to, $self->uri)
- # : (QUOTE. $to .QUOTE, QUOTE. $self->uri .QUOTE);
-
- ### shell out ###
- my $captured;
- unless(run( command => $cmd,
- buffer => \$captured,
- verbose => $DEBUG
- )) {
- ### wget creates the output document always, even if the fetch
- ### fails.. so unlink it in that case
- 1 while unlink $to;
-
- return $self->_error(loc( "Command failed: %1", $captured || '' ));
- }
-
- return $to;
-
- } else {
- $METHOD_FAIL->{'wget'} = 1;