civilvar 发表于 2018-8-30 12:12:49

perl5.8.8 Net::FTP问题

sub download{  
      my $ftp = Net::FTP->new("$_",Timeout => 5,Passive => 0) or die "Can't connect to the Ftp :$@\n";
  
      $ftp->login("$config{ftp_user}","$config{ftp_pass}") or die "Can't login . ",$ftp->message;
  
      $ftp->binary or die "Cannot change binary mode ", $ftp->message;
  
      printcolor bold,"\nInput the subdir:\n";
  
      printcolor blue,"$config{ftp_host}:$config{ftp_root_dir}/";
  
      chomp($ftp_sub_dir=);
  
      $ftp->cwd("$config{ftp_root_dir}/$ftp_sub_dir") or die "Change File:",$ftp->message;
  
      printcolor green,"Change DirSuccess!\n";
  
      printcolor bold,"Input the filename:";
  
      chomp($down_file=);
  
      printcolor blue,"\nDownloading...Please Wait.\n";
  
      $ftp->get("$down_file","$config{local_dir}/$down_file") or die "Can't get the $down_file . ",$ftp->message;
  
      printcolor green,"+++ Download Success! +++\n\nMD5: ";
  
      $ftp->quit;
  
      open L_FILE,"$config{local_dir}/$down_file";
  
      printcolor yellow,Digest::MD5->new->addfile(L_FILE)->hexdigest,"\t$config{local_dir}/$down_file\n\n" ;
  
      close L_FILE;
  
}


页: [1]
查看完整版本: perl5.8.8 Net::FTP问题