1

Is it really required to explicitly close the Net::SSH2 connection, Net::SSH2 channel or the Net::Telnet connection in Perl?

If so what would be the consequences of not closing them?

Learath2
  • 20,023
  • 2
  • 20
  • 30
Sujeet Padhi
  • 254
  • 1
  • 20
  • 1
    Close voters: I think the question is pretty clear. What happens if you don't explicitly close an SSH or Telnet connection before script exit? This is similar to [How severe is it if we do not close a file in Perl?](http://stackoverflow.com/q/12702869) – ThisSuitIsBlackNot Mar 20 '17 at 16:34
  • What I don't like about the question is that it sounds like they are trying to prove something wrong, but don't include a source. With a small edit, I'd vote to reopen. – simbabque Mar 20 '17 at 16:41
  • Can somebody please answer ? – Sujeet Padhi Mar 20 '17 at 17:54
  • What I don't get is what "in perl" has to do with the question? – Tanktalus Mar 20 '17 at 17:56
  • What's a "channel"? – Borodin Mar 20 '17 at 18:18
  • @Borodin: I have updated the question. Apologies for the confusion. Kindly help me out with the query. – Sujeet Padhi Mar 20 '17 at 18:22
  • If you don't close channels/connections, they will be automatically closed for you from the objects destructors when they go out of scope. The advantage of doing it explicitly is that you can catch errors. – salva Mar 21 '17 at 07:45
  • @salva The question has been reopened now, so can you post that as an answer? You're uniquely qualified to answer this one :) – ThisSuitIsBlackNot Mar 21 '17 at 15:43

0 Answers0