Re: [Ssh-sftp-perl-users] Can I test for connection reset and also supress warnings
Brought to you by:
dbrobins
From: Heiko J. <ja...@hb...> - 2008-07-30 07:32:11
|
Am Dienstag, den 29.07.2008, 13:54 -0400 schrieb Steve Comrie: > First, it would appear as though my clients SFTP server is occasionally > reseting (or dropping) the connection. When this happens my automated > transfer script completely dies with a closing connection message. Is it > possible for me to trap this error (or test whether or not my $sftp > object is connected) and have the script reconnect to the server to > resume transfer? You should be able to wrap the problematic method call with an "eval" and have a look at $@ afterwards. And according to the Net::SFTP perldoc there ist the status() method to find out if something nasty happened after you called any of the other methods except from new(). > And secondly, the less important issue... my clients server doesn't > allow me to fsetstat which doesn't appear to be a problem at all, but > the script is outputting a large number of "Couldn't fsetstat: Operation > unsupported" messages. I'd like to disable only that message if possible > as it's not entirely useful while other error messages & warnings are. As far as I know, you cannot disable one specific warning - but you can pass a sub ref as argument "warn" to the new() method in which you can then decide what to do with the warnings you receive. See the perldoc for more info. Hope this helps Heiko |