in reply to Re^4: FTPSSL Bad file number
in thread FTPSSL Bad file number

156 $ftp->get($file) or $e +rror_flag = 1; 157 $ftp->quit() if $error +_flag; 158 $ftp->delete($file) or + $error_flag = 1; 159 $ftp->quit() if $error +_flag;

What happens when $ftp->get($file) in line 156 fails?

  1. $error_flag is set in the same line
  2. $ftp->quit() is called, in line 157. Tthis will close the FTP connection.
  3. $ftp->delete() is called, in line 158. This will fail, because the FTP connection in $ftp is closed.
  4. $error_flag is set again, in line 158.
  5. $ftp->quit() is called again, in line 159. This will fail again, because the FTP connectin in $ftp is still closed.

I don't think this is what you really want. You want to abort when $ftp->get($file) fails. Why don't you use die and eval {...} instead of fiddling with error flags? Or at least break out of the foreach loop using last?

Anonymous Monk explained this problem in the first reply, but it seems you ignored it or did not understand it.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)