I'm trying to get started with Net::SFTP
, but I wasn't able to find in its documentation or in the documentation for Net::SSH::Perl
, how we're supposed to log out of the SFTP server.
What am I missing?
Is logout handled by garbage control?
Exit sFTP ShellType 'exit' command where we can see sftp> prompt return.
You can't.
I've looked at the source code for both Net::SFTP and Net::SSH::Perl. Neither of them has a DESTROY
method, so there is no explicit cleanup being done. There are also no disconnect
or quit
or similar.
Net::SSH::Perl has a sub _disconnect
which is empty. It's called by sub fatal_disconnect
. fatal_disconnect
is used by Net::SFTP in case an SFTP request failed. But that's it. Nothing else.
The objects get cleaned up by Perl as soon as they go out of scope.
{
my $sftp = Net::SFTP->connect; # example
# do stuff...
}
# here it has been cleaned up and DESTROY was called on it
But since there is no code, nothing else happens. I cannot find code that tells the SSH to log out. Maybe it just times out. We would have to look at the server logs to see what happens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With