Net::SS...:Handle(3)

πŸ“¦
version 2.144 Β· 4 versions
, in fedora 44

πŸ’– Net::SS...:Handle(3) πŸ’–

okay so bestie, welcome to Net::SS...:Handle(3), filed under User Contributed Perl Documentation β€” yes that's the manual name, it's giving "we the people of perl dot org wrote this ourselves" and honestly? iconic. 🫢

and yeah the module name really is written like Net::SS...:Handle(3), ellipsis and all. that's not me being lazy, that's literally the title. iykyk. ✨

this page is short and sweet β€” no NAME section, no SYNOPSIS, no OPTIONS list, no SEE ALSO, no nothing. it's just one thing: a destructor. and tbh a destructor is a whole personality. πŸ’…


πŸŽ€ the code (the whole page, fr fr) πŸŽ€

here's the entire vibe, verbatim, do not touch a single character:

sub DESTROY {
    my $h = shift;
    unless ($h->{incoming}) {
        my $c = $h->{channel};
        my $ssh = $c->{ssh};
        $c->{istate} = CHAN_INPUT_WAIT_DRAIN;
        $c->send_eof;
        $c->{istate} = CHAN_INPUT_CLOSED;
        $ssh->client_loop;
    } }

so let's walk through it like we're gossiping, because we basically are:

  • sub DESTROY β€” this is the destructor, the method Perl comes for when the object is done. main character exit energy, no cap. πŸ‘‘
  • my $h = shift; β€” grabs the handle off the argument list. first thing it does, every time, no exceptions.
  • unless ($h->{incoming}) β€” big gate moment. everything below only happens when incoming is falsy. if incoming is truthy, this sub literally just says "not my problem" and dips. πŸ’€
  • my $c = $h->{channel}; β€” pulls the channel out of the handle and stashes it in $c.
  • my $ssh = $c->{ssh}; β€” pulls the ssh out of the channel and stashes it in $ssh. it just sits there being held until the very last line, that's called ✨foreshadowing✨.
  • $c->{istate} = CHAN_INPUT_WAIT_DRAIN; β€” sets the channel's istate to CHAN_INPUT_WAIT_DRAIN. that constant name is doing a lot of emotional labor, and we respect it.
  • $c->send_eof; β€” calls send_eof on the channel. bye-bye, EOF time. 🌸
  • $c->{istate} = CHAN_INPUT_CLOSED; β€” and now istate becomes CHAN_INPUT_CLOSED. closed for business, doors locked, lights off. πŸ¦‹
  • $ssh->client_loop; β€” there it is. the $ssh we grabbed like four lines ago finally gets used. called on the ssh object, last line of the block, and that's the whole sub. periodt.
note: this is all inside unless ($h->{incoming}), and the closing braces at the end are } } β€” two of them, on the same line, the way the original wrote them. copy it exactly, bestie, don't "tidy" it. πŸ™ˆ

and that's the entire page. no more, no less, no hidden bonus options, we checked twice. 🧚

bye bestie!! this was Net::SS...:Handle(3) from the User Contributed Perl Documentation, rendered by perl v5.42.0, dated 2026-01-17 β€” mwah, go forth and let your destructors destroy responsibly πŸ’œπŸŒˆβ­

πŸ“¦ where this page comes from