General discussion

Locked

Perl and FTP

By gjohnson ·
I have written a script that has a subroutine that moves some files via FTP. The problem is that sometimes the FTP server is down. This causes the program to die. I am trying to add fault tolerance to the program, but haven't been able to get thesubroutine to just return gracefully to the calling routine. I have tried an unless($ftp->login...){return 0} but it doesn't seem to work. Any ideas on putting putting some error handling on the ftp call would be greatly appreciated

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Perl and FTP

by gspecht In reply to Perl and FTP

I recently had a similar problem.. I created a function to 'ping' the server and return true or false if the server respnded to the ping. This avoids trying to logon to a non-responcive server.

Collapse -

Perl and FTP

by gjohnson In reply to Perl and FTP

This doesn't help. Although it may ping, that doesn't mean that the connect will occur. The problem is that I have a bad connect, the entire program abends. I recently figured out the problem. I put the subroutine call in an "eval { &subroutine }; " block, then the "die" statements in the subroutine don't kill the calling program, I get a nicely formatted error message at $@ that you can print out.

Thanks for your help anyway.

George

Collapse -

Perl and FTP

by gjohnson In reply to Perl and FTP

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums