Hello glasswalk3r,
Why not use Net::OpenSSH or Net::OpenSSH::Parallel where you can set on the options close_slave_pty => 0 and then close the slave your self like: $slave = $pty->slave; close($slave).
From Net::OpenSSH documentation:
close_slave_pty => 0 When a pseudo pty is used for the stdin stream, the slave side is auto +matically closed on the parent process after forking the ssh command. This option disables that feature, so that the slave pty can be access +ed on the parent process as $pty->slave. It will have to be explicitl +y closed (see IO::Pty).
The question is why you want to explicitly close the connection? As you said (I assume that the connection will be closed automatically when the object goes out of scope, but I prefer explicit than implicit behavior. :-)) well by reading this question Is it really required to explicitly close the SSH connection, channel or the telnet connection in Perl? the author of the module salva states:
If you don't close channels/connections, they will be automatically cl +osed for you from the objects destructors when they go out of scope. +The advantage of doing it explicitly is that you can catch errors.
Hope this helps, BR.
In reply to Re: Explicit closing connections with Net::SSH::Any
by thanos1983
in thread Explicit closing connections with Net::SSH::Any
by glasswalk3r
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |